[flang-commits] [flang] 3151fb5 - [flang] Change C889 from error into warning

via flang-commits flang-commits at lists.llvm.org
Wed Jun 15 00:39:48 PDT 2022


Author: Peixin-Qiao
Date: 2022-06-15T15:39:13+08:00
New Revision: 3151fb5ef7249d5d0a293daea6af756856800005

URL: https://github.com/llvm/llvm-project/commit/3151fb5ef7249d5d0a293daea6af756856800005
DIFF: https://github.com/llvm/llvm-project/commit/3151fb5ef7249d5d0a293daea6af756856800005.diff

LOG: [flang] Change C889 from error into warning

This constraint is used in OMP2012 benchmark, and other compilers do not
enforce it. Change it into one warning. This addresses the issue
https://github.com/llvm/llvm-project/issues/56003.

Reviewed By: klausler, kiranchandramohan

Differential Revision: https://reviews.llvm.org/D127740

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-names.cpp
    flang/test/Semantics/resolve45.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 99a5da166f5e8..d5e883feedfd9 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -5251,7 +5251,7 @@ void DeclarationVisitor::CheckSaveStmts() {
     } else if (specPartState_.saveInfo.saveAll) {
       // C889 - note that pgi, ifort, xlf do not enforce this constraint
       Say2(name,
-          "Explicit SAVE of '%s' is redundant due to global SAVE statement"_err_en_US,
+          "Explicit SAVE of '%s' is redundant due to global SAVE statement"_warn_en_US,
           *specPartState_.saveInfo.saveAll, "Global SAVE statement"_en_US);
     } else if (auto msg{CheckSaveAttr(*symbol)}) {
       Say(name, std::move(*msg));

diff  --git a/flang/test/Semantics/resolve45.f90 b/flang/test/Semantics/resolve45.f90
index 2402586fd4e1a..61e766356541f 100644
--- a/flang/test/Semantics/resolve45.f90
+++ b/flang/test/Semantics/resolve45.f90
@@ -34,13 +34,13 @@ subroutine s3(x)
 end
 
 subroutine s4
-  !ERROR: Explicit SAVE of 'z' is redundant due to global SAVE statement
+  !WARNING: Explicit SAVE of 'z' is redundant due to global SAVE statement
   save z
   save
   procedure(integer), pointer :: x
-  !ERROR: Explicit SAVE of 'x' is redundant due to global SAVE statement
+  !WARNING: Explicit SAVE of 'x' is redundant due to global SAVE statement
   save :: x
-  !ERROR: Explicit SAVE of 'y' is redundant due to global SAVE statement
+  !WARNING: Explicit SAVE of 'y' is redundant due to global SAVE statement
   integer, save :: y
 end
 


        


More information about the flang-commits mailing list