This is an archive of the discontinued LLVM Phabricator instance.

[flang] Allow restricted specific intrinsic functions as implicitly-interfaced procedure pointer targets
ClosedPublic

Authored by klausler on Jul 22 2022, 12:23 PM.

Details

Summary

The predicate "CanBeCalledViaImplicitInterface()" was returning false for
restricted specific intrinsic functions (e.g., SIN) because their procedure
characteristics have the elemental attribute; this leads to a bogus semantic
error when one attempts to use them as proc-targets in procedure pointer
assignment statements when the left-hand side of the assignment is a procedure
pointer with an implicit interface. However, these restricted specific intrinsic
functions have always been allowed as special cases for such usage -- it is
as if they are elemental when it is necessary for them to be so, but not
when it's a problem.

Diff Detail

Event Timeline

klausler created this revision.Jul 22 2022, 12:23 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Jul 22 2022, 12:23 PM

Build bots is hitting a failure in Semantics/associated.f90

Build bots is hitting a failure in Semantics/associated.f90

It'll clear up after other patches are merged and I rebase.

jeanPerier accepted this revision.Jul 25 2022, 10:44 AM

Build bots is hitting a failure in Semantics/associated.f90

It'll clear up after other patches are merged and I rebase.

OK, the patch looks good otherwise, you do not need me to check the bots.

This revision is now accepted and ready to land.Jul 25 2022, 10:44 AM
ekieri added a subscriber: ekieri.Aug 16 2022, 12:21 PM

I am sorry the warning patch (D125804) is taking so long, I have not found much time to work with Flang lately. This patch causes a mismatch between emitted and expected warnings in associated.f90, line 141. Could you please have a look to see if the changed warning message is deliberate or not?

I am sorry the warning patch (D125804) is taking so long, I have not found much time to work with Flang lately. This patch causes a mismatch between emitted and expected warnings in associated.f90, line 141. Could you please have a look to see if the changed warning message is deliberate or not?

A warning is appropriate there.

I am sorry the warning patch (D125804) is taking so long, I have not found much time to work with Flang lately. This patch causes a mismatch between emitted and expected warnings in associated.f90, line 141. Could you please have a look to see if the changed warning message is deliberate or not?

A warning is appropriate there.

Agree. Previously, the warning was about the dummy variable having incompatible attributes (intent(in) and value, respectively) for pointer and target. Now it is about the procedure being elemental when the pointer is not. Can you confirm this change is desired? Sorry if I was unclear.

I am sorry the warning patch (D125804) is taking so long, I have not found much time to work with Flang lately. This patch causes a mismatch between emitted and expected warnings in associated.f90, line 141. Could you please have a look to see if the changed warning message is deliberate or not?

A warning is appropriate there.

Agree. Previously, the warning was about the dummy variable having incompatible attributes (intent(in) and value, respectively) for pointer and target. Now it is about the procedure being elemental when the pointer is not. Can you confirm this change is desired? Sorry if I was unclear.

Yes, the current warning is correct.