This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix bug with intrinsic in type declaration stmt
ClosedPublic

Authored by tskeith on Jul 27 2020, 1:58 PM.

Details

Summary

When an instrinsic function is declared in a type declaration statement
we need to set the INTRINSIC attribute and (per 8.2(3)) ignore the
specified type.

To simplify the check, add IsIntrinsic utility to BaseVisitor.

Also, intrinsics and external procedures were getting assigned a size
and offset and they shouldn't be.

Diff Detail

Event Timeline

tskeith created this revision.Jul 27 2020, 1:58 PM
Herald added a project: Restricted Project. · View Herald Transcript
klausler added inline comments.Jul 27 2020, 2:00 PM
flang/lib/Semantics/resolve-names.cpp
6092

Can you really ignore the type? Should not INTEGER :: ASIN be an error?

tskeith marked an inline comment as done.Jul 27 2020, 2:13 PM
tskeith added inline comments.
flang/lib/Semantics/resolve-names.cpp
6092

It explicitly not an error. 8.2(3) says "Specifying a type for a generic intrinsic function name in a type declaration statement has no effect."

All of the compilers that I tried accepted it without comment except for NAG which warned "Type declaration for generic intrinsic ASIN ignored".

PeteSteinfeld accepted this revision.Jul 27 2020, 2:31 PM

All builds, tests, and looks good.

Note that the latest version of clang-format shows diffs on resolve-names.cpp unrelated to your changes.

This revision is now accepted and ready to land.Jul 27 2020, 2:31 PM
This revision was automatically updated to reflect the committed changes.