This is an archive of the discontinued LLVM Phabricator instance.

[flang] Align same_type_as result to other compilers
ClosedPublic

Authored by clementval on Mar 6 2023, 7:20 AM.

Details

Summary

Unallocated unlimited polymorphic entities do not have a dynamic type set
and do not have declared type. The standard notes that the result is
processor dependent when one of the arguments of same_type_as is in this
case. Align the result to other compiler (gfortran, nvfortran).

Diff Detail

Event Timeline

clementval created this revision.Mar 6 2023, 7:20 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added a subscriber: sunshaoce. · View Herald Transcript
clementval requested review of this revision.Mar 6 2023, 7:20 AM
jeanPerier added inline comments.Mar 6 2023, 9:02 AM
flang/runtime/derived-api.cpp
97–103

Wouldn't this be hit if both A and B are allocated but A or B is an unlimited polymorphic allocated to an intrinsic type? (I do not see where the "unallocated" aspect is tested).

PeteSteinfeld accepted this revision.Mar 6 2023, 9:04 AM

All builds and tests correctly and looks good.

flang/runtime/derived-api.cpp
97

"the descriptor" should be "read descriptors".

This revision is now accepted and ready to land.Mar 6 2023, 9:04 AM
clementval added inline comments.Mar 7 2023, 12:35 AM
flang/runtime/derived-api.cpp
97–103

Yes. I'll add a check at the beginning for non derived type descriptor.

Update test

This revision was automatically updated to reflect the committed changes.