mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-25 17:31:02 +00:00
[flang] Fix bug checking SAVE attribute
Treat function result like dummy argument: a SAVE statement without an entity-list does not make it saved. Differential Revision: https://reviews.llvm.org/D82309
This commit is contained in:
parent
809bcf4c87
commit
663860f63e
@ -1003,7 +1003,7 @@ bool IsSaved(const Symbol &original) {
|
||||
} else if (const Symbol * block{FindCommonBlockContaining(symbol)};
|
||||
block && block->attrs().test(Attr::SAVE)) {
|
||||
return true;
|
||||
} else if (IsDummy(symbol)) {
|
||||
} else if (IsDummy(symbol) || IsFunctionResult(symbol)) {
|
||||
return false;
|
||||
} else {
|
||||
for (; !scope->IsGlobal(); scope = &scope->parent()) {
|
||||
|
@ -15,8 +15,15 @@ function f2(x, y)
|
||||
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
|
||||
complex, save :: x
|
||||
allocatable :: y
|
||||
integer :: y
|
||||
!ERROR: SAVE attribute may not be applied to dummy argument 'y'
|
||||
integer, save :: y
|
||||
save :: y
|
||||
end
|
||||
|
||||
! SAVE statement should not trigger the above errors
|
||||
function f2b(x, y)
|
||||
real :: x, y
|
||||
save
|
||||
end
|
||||
|
||||
subroutine s3(x)
|
||||
|
Loading…
Reference in New Issue
Block a user