[flang-commits] [PATCH] D147390: [flang] NORM2(DIM=) argument can't be dynamically optional

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Apr 3 09:04:48 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0e28fe62c756: [flang] NORM2(DIM=) argument can't be dynamically optional (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147390

Files:
  flang/lib/Evaluate/intrinsics.cpp
  flang/test/Semantics/dim01.f90


Index: flang/test/Semantics/dim01.f90
===================================================================
--- flang/test/Semantics/dim01.f90
+++ flang/test/Semantics/dim01.f90
@@ -18,6 +18,8 @@
     integer, optional, intent(in) :: d
     !PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time
     f1 = sum(a,dim=d)
+    !PORTABILITY: The actual argument for DIM= is optional, pointer, or allocatable, and it is assumed to be present and equal to 1 at execution time
+    f1 = norm2(a,dim=d)
   end function
   function f2(a,d)
     real, intent(in) :: a(:)
@@ -49,6 +51,8 @@
     real, allocatable :: f11(:)
     !WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning
     f11 = sum(a,dim=d)
+    !WARNING: The actual argument for DIM= is optional, pointer, or allocatable, and may not be absent during execution; parenthesize to silence this warning
+    f11 = norm2(a,dim=d)
   end function
   function f12(a,d)
     real, intent(in) :: a(:,:)
@@ -65,4 +69,3 @@
     f13 = sum(a,dim=d)
   end function
 end module
-
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -685,8 +685,10 @@
             common::Intent::In, {ArgFlag::canBeNull}}},
         SameCharNoLen, Rank::scalar, IntrinsicClass::inquiryFunction},
     {"nint", {{"a", AnyReal}, DefaultingKIND}, KINDInt},
-    {"norm2", {{"x", SameReal, Rank::array}, OptionalDIM}, SameReal,
+    {"norm2", {{"x", SameReal, Rank::array}, RequiredDIM}, SameReal,
         Rank::dimReduced, IntrinsicClass::transformationalFunction},
+    {"norm2", {{"x", SameReal, Rank::array}, MissingDIM}, SameReal,
+        Rank::scalar, IntrinsicClass::transformationalFunction},
     {"not", {{"i", SameInt}}, SameInt},
     // NULL() is a special case handled in Probe() below
     {"num_images", {}, DefaultInt, Rank::scalar,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147390.510524.patch
Type: text/x-patch
Size: 2097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230403/8a27724f/attachment-0001.bin>


More information about the flang-commits mailing list