[PATCH] D82309: [flang] Fix bug checking SAVE attribute
Tim Keith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 22 10:44:54 PDT 2020
tskeith updated this revision to Diff 272488.
tskeith added a comment.
Move fix into IsSaved.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82309/new/
https://reviews.llvm.org/D82309
Files:
flang/lib/Evaluate/tools.cpp
flang/test/Semantics/resolve45.f90
Index: flang/test/Semantics/resolve45.f90
===================================================================
--- flang/test/Semantics/resolve45.f90
+++ flang/test/Semantics/resolve45.f90
@@ -15,8 +15,15 @@
!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)
Index: flang/lib/Evaluate/tools.cpp
===================================================================
--- flang/lib/Evaluate/tools.cpp
+++ flang/lib/Evaluate/tools.cpp
@@ -1003,7 +1003,7 @@
} 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()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82309.272488.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/a65a775f/attachment.bin>
More information about the llvm-commits
mailing list