[flang-commits] [clang] [flang] [flang][semantics] Add a flag to relax some of the semantic constraints on C_LOC (PR #195112)
Andre Kuhlenschmidt via flang-commits
flang-commits at lists.llvm.org
Fri May 1 16:47:00 PDT 2026
================
@@ -3539,20 +3554,24 @@ std::optional<SpecificCall> IntrinsicProcTable::Implementation::HandleC_Loc(
"C_LOC() argument has non-interoperable intrinsic type or kind"_warn_en_US);
}
}
-
characteristics::DummyDataObject ddo{std::move(*typeAndShape)};
ddo.intent = common::Intent::In;
- return SpecificCall{
- SpecificIntrinsic{"__builtin_c_loc"s,
- characteristics::Procedure{
- characteristics::FunctionResult{
- DynamicType{GetBuiltinDerivedType(
- builtinsScope_, "__builtin_c_ptr")}},
- characteristics::DummyArguments{
- characteristics::DummyArgument{"x"s, std::move(ddo)}},
- characteristics::Procedure::Attrs{
- characteristics::Procedure::Attr::Pure}}},
- std::move(arguments)};
+ specificCall.specificIntrinsic.characteristics.value()
+ .dummyArguments.emplace_back(
+ characteristics::DummyArgument{"x", std::move(ddo)});
+ specificCall.arguments.emplace_back(std::move(arguments[0]));
+ return specificCall;
+ } else if (expr && IsProcedurePointer(*expr)) {
+ auto dummyArg{characteristics::DummyArgument::FromActual(
+ "x", *expr, context, /*forImplicitInterface=*/false)};
+ CHECK(dummyArg.has_value());
+ specificCall.specificIntrinsic.characteristics.value()
+ .dummyArguments.emplace_back(std::move(*dummyArg));
+ specificCall.arguments.emplace_back(std::move(arguments[0]));
+ return specificCall;
+ } else {
+ context.messages().Say(arguments[0]->sourceLocation(),
+ "C_LOC() argument must be a object or procedure"_err_en_US);
----------------
akuhlens wrote:
Actually I just did away with the error message. The cases that I could figure out fell into that case had more specific error messages about how things where going wrong.
https://github.com/llvm/llvm-project/pull/195112
More information about the flang-commits
mailing list