Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #670: Internal compiler error #919

Closed
wants to merge 1 commit into from

Conversation

gklimowicz
Copy link
Contributor

The issue as reported is about the use of BOZ constants,
but the internal compiler error was generated by the handling
of the array constructor in the parameter definition.

This fix from the NVIDIA compiler addresses the issue.

Added two tests as well, from the original issue, and
a cut-down version used internally to identify the fix.

The issue as reported is about the use of BOZ constants,
but the internal compiler error was generated by the handling
of the array constructor in the parameter definition.

This fix from the NVIDIA compiler addresses the issue.

Added two tests as well, from the original issue, and
a cut-down version used internally to identify the fix.
Copy link
Collaborator

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Passed a test suite internally.

Have a question about a negative test. See inline comment.

@@ -13286,7 +13286,7 @@ fixup_param_vars(SST *var, SST *init)
sptr1 = get_param_alias_var(sptr, dtype);
} else if (DTY(dtype) == TY_ARRAY) {
ad = AD_DPTR(dtype);
if (AD_ASSUMSZ(ad) || AD_ADJARR(ad) || AD_DEFER(ad)) {
if (AD_ADJARR(ad) || AD_DEFER(ad)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flang would have given an error here for the following code previously, with this change the error does not appear.

program test
  integer, parameter :: asumed_sz(*) = 1
  print *, assumed_sz(1)
end program

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the initializer in your example was changed to (/1/), the shape should be implied to be DIMENSION(1), but Flang currently would still complain incorrectly. gfortran can compile that case successfully.

Setting an assumed-shape array to a scalar integer has unclear semantics, and Flang should complain about this case.

It seems to me that the code should differentiate these cases and produce errors (or not) accordingly.

@gklimowicz
Copy link
Contributor Author

There's some kind of interaction with this fix in Flang that doesn't appear in the NVIDIA compiler. I need to dig further to see if there are other changes that are also required to me merged. (I didn't see anything when I first looked, but something here can't be explained.)

@bryanpkc
Copy link
Collaborator

bryanpkc commented Oct 5, 2023

I have checked with the latest master branch, and the problem is no longer occurring, thanks to a fix that landed as 97527ab. Both test cases in this PR run correctly, and the compiler behaves correctly in the case mentioned by Kiran.

@bryanpkc
Copy link
Collaborator

bryanpkc commented Oct 5, 2023

Closing stale PR.

@bryanpkc bryanpkc closed this Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants