[flang-commits] [PATCH] D155975: [flang] Fix portability warning that was incorrectly an "else if"

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 21 15:35:19 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24d293913c21: [flang] Fix portability warning that was incorrectly an "else if" (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155975/new/

https://reviews.llvm.org/D155975

Files:
  flang/lib/Semantics/check-declarations.cpp
  flang/test/Semantics/call01.f90


Index: flang/test/Semantics/call01.f90
===================================================================
--- flang/test/Semantics/call01.f90
+++ flang/test/Semantics/call01.f90
@@ -118,16 +118,19 @@
   end function nested
 end function
 
-subroutine s01(f1, f2, fp1, fp2)
+subroutine s01(f1, f2, fp1, fp2, fp3)
   !PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
   character*(*) :: f1, f3, fp1
   external :: f1, f3
-  pointer :: fp1
+  pointer :: fp1, fp3
   !PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
   procedure(character*(*)), pointer :: fp2
   interface
     character*(*) function f2()
     end function
+    !PORTABILITY: A dummy procedure pointer should not have assumed-length CHARACTER(*) result type
+    character*(*) function fp3()
+    end function
     !ERROR: A function interface may not declare an assumed-length CHARACTER(*) result
     character*(*) function f4()
     end function
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -397,7 +397,8 @@
         messages_.Say(
             "An assumed-length CHARACTER(*) function cannot return a POINTER"_err_en_US);
       }
-    } else if (IsProcedurePointer(symbol) && IsDummy(symbol)) {
+    }
+    if (IsProcedurePointer(symbol) && IsDummy(symbol)) {
       messages_.Say(
           "A dummy procedure pointer should not have assumed-length CHARACTER(*) result type"_port_en_US);
       // The non-dummy case is a hard error that's caught elsewhere.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155975.543099.patch
Type: text/x-patch
Size: 1692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230721/7fe6cd2c/attachment.bin>


More information about the flang-commits mailing list