This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fixes for RESHAPE()
ClosedPublic

Authored by PeteSteinfeld on Jul 29 2020, 6:14 PM.

Details

Summary

I fixed an assert caused by passing an empty array as the source= argument to
RESHAPE(). In the process, I noticed that there were no tests for RESHAPE(),
so I wrote a test that covers all the description in 16.9.163. In the process,
I made the error messages more consistent and descriptive. I also changed the
test to see if a reference to an intrinsic function was a constant to say that
it is a constant if it's a refererence to an invalid intrinsic. This avoids
emitting multiple messages for the same erroneous source.

Diff Detail

Event Timeline

PeteSteinfeld created this revision.Jul 29 2020, 6:14 PM
Herald added a project: Restricted Project. · View Herald Transcript
PeteSteinfeld requested review of this revision.Jul 29 2020, 6:14 PM
PeteSteinfeld added a project: Restricted Project.Jul 29 2020, 6:15 PM
tskeith added inline comments.Jul 30 2020, 9:06 AM
flang/lib/Evaluate/fold-implementation.h
621

This message doesn't need to be split to fit into 80 columns.

625

Same here.

flang/test/Semantics/reshape.f90
28

To be consistent with the messages above, order= should be in quotes.

tskeith added inline comments.Jul 30 2020, 9:11 AM
flang/lib/Evaluate/check-expression.cpp
49

This string should be a named constant, maybe in fold-implementation.h.

I fixed the error messages to put quotes around the names of arguments.

I also created a constant for the name of the invalid intrinsic created when
constant folding runs into errors.

tskeith accepted this revision.Jul 30 2020, 4:03 PM
This revision is now accepted and ready to land.Jul 30 2020, 4:03 PM
This revision was automatically updated to reflect the committed changes.