[PATCH] D82309: [flang] Fix bug checking SAVE attribute

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 11:51:03 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG663860f63e73: [flang] Fix bug checking SAVE attribute (authored by tskeith).

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.272512.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/b5c4b37e/attachment.bin>


More information about the llvm-commits mailing list