[flang-commits] [flang] [flang] C_LOC is PURE (PR #89437)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Apr 19 11:47:32 PDT 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/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.
>From 04f4629fb55a84c68edc13af9510617d82bebad3 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Fri, 19 Apr 2024 11:45:13 -0700
Subject: [PATCH] [flang] C_LOC is PURE
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.
---
flang/lib/Evaluate/intrinsics.cpp | 3 ++-
flang/module/__fortran_builtins.f90 | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-)
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