[flang-commits] [PATCH] D123947: [flang] Fix ICE for passing a label for non alternate return arguments

Daniil Dudkin via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Apr 20 03:59:55 PDT 2022


unterumarmung updated this revision to Diff 423865.
unterumarmung added a comment.

Rebased, removed useless restorer, address review comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123947

Files:
  flang/lib/Semantics/check-call.cpp
  flang/test/Semantics/call26.f90


Index: flang/test/Semantics/call26.f90
===================================================================
--- /dev/null
+++ flang/test/Semantics/call26.f90
@@ -0,0 +1,12 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+module m
+  contains
+    subroutine s(x)
+      integer, intent(in) :: x
+    end
+    subroutine s2
+      !ERROR: Alternate return label '42' can't be associated with dummy argument 'x='
+      call s(*42)
+      42 stop
+    end
+end module m
Index: flang/lib/Semantics/check-call.cpp
===================================================================
--- flang/lib/Semantics/check-call.cpp
+++ flang/lib/Semantics/check-call.cpp
@@ -675,6 +675,12 @@
   common::visit(
       common::visitors{
           [&](const characteristics::DummyDataObject &object) {
+            if (arg.isAlternateReturn()) {
+              messages.Say(
+                  "Alternate return label '%d' can't be associated with %s"_err_en_US,
+                  arg.GetLabel(), dummyName);
+              return;
+            }
             ConvertBOZLiteralArg(arg, object.type.type());
             if (auto *expr{arg.UnwrapExpr()}) {
               if (auto type{characteristics::TypeAndShape::Characterize(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123947.423865.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220420/f8197ef0/attachment-0001.bin>


More information about the flang-commits mailing list