[flang-commits] [flang] fde5e47 - [flang] C_LOC is PURE (#89437)

via flang-commits flang-commits at lists.llvm.org
Mon Apr 22 15:33:20 PDT 2024


Author: Peter Klausler
Date: 2024-04-22T15:33:17-07:00
New Revision: fde5e471df3e946482422c10fa422b09a854c7cb

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

LOG: [flang] C_LOC is PURE (#89437)

The standard defines C_LOC as being PURE (actually SIMPLE now in
F'2023); characterize it appropriately.

Fixes https://github.com/llvm/llvm-project/issues/88747.

Added: 
    

Modified: 
    flang/lib/Evaluate/intrinsics.cpp
    flang/module/__fortran_builtins.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 7226d69f6391c7..f07f94b1a022c9 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -2862,7 +2862,8 @@ std::optional<SpecificCall> IntrinsicProcTable::Implementation::HandleC_Loc(
                                       characteristics::DummyArgument{"x"s,
                                           characteristics::DummyDataObject{
                                               std::move(*typeAndShape)}}},
-                                  characteristics::Procedure::Attrs{}}},
+                                  characteristics::Procedure::Attrs{
+                                      characteristics::Procedure::Attr::Pure}}},
           std::move(arguments)};
     }
   }

diff  --git a/flang/module/__fortran_builtins.f90 b/flang/module/__fortran_builtins.f90
index 3d3dbef6d018aa..4746ca20a13a7e 100644
--- a/flang/module/__fortran_builtins.f90
+++ b/flang/module/__fortran_builtins.f90
@@ -18,6 +18,7 @@
   private
 
   intrinsic :: __builtin_c_loc
+  public :: __builtin_c_loc
 
   intrinsic :: __builtin_c_f_pointer
   public :: __builtin_c_f_pointer
@@ -56,8 +57,6 @@
   integer, parameter, public :: &
     __builtin_atomic_logical_kind = __builtin_atomic_int_kind
 
-  procedure(type(__builtin_c_ptr)), public :: __builtin_c_loc
-
   type, public :: __builtin_dim3
     integer :: x=1, y=1, z=1
   end type


        


More information about the flang-commits mailing list