-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[flang] Don't associate pointers with zero sized storage targets #155867
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
Conversation
flang-rt/lib/runtime/pointer.cpp
Outdated
| void RTDEF(PointerAssociate)(Descriptor &pointer, const Descriptor &target) { | ||
| pointer = target; | ||
| pointer.raw().attribute = CFI_attribute_pointer; | ||
| if (target.ElementBytes() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would leave the pointer unchanged when the target is an empty storage sequence, which would be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. The pointer object will still need to get the dynamic type and etc from the target even though it's association status is not associated with the zero-sized storage sequence.
DanielCChen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
It fixed all the test cases marked against this issue.
Thanks!
klausler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the llvm-test-suite before merging; I think that GNU handles this case incorrectly and probably confirms it with a test; if so, it'll need to be disabled.
flang-rt/lib/runtime/pointer.cpp
Outdated
| } | ||
| if (!target->raw().base_addr || | ||
| (target->raw().type != CFI_type_struct && target->ElementBytes() == 0)) { | ||
| if (!target->raw().base_addr || target->ElementBytes() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the case of ElementBytes() != 0 but no elements?
I did. These failures happen for me even without my change: I think eoshift needs to run at |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/143/builds/10381 Here is the relevant piece of the build log for the reference |
For some reason this test doesn't run for x86, so it didn't fail for me. (I should start running llvm-test-suite on ARM as well.) I'll disable the test, since gfortran's behavior is now different from flang's. |
|
PR for llvm-test-suite: llvm/llvm-test-suite#279 |
Fixes #155481