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: use a bigger real transfering mask_val #1586

Closed
wants to merge 1 commit into from

Conversation

inaki-amatria
Copy link

@inaki-amatria inaki-amatria commented Sep 5, 2024

This change ensures the type of mask_val is big enough to satisfy the transfer; otherwise, we risk transfering a 4-byte value to 2-element arrays of 4-byte elements (i.e., i4tmp(2) and r4tmp(2))

I encountered this issue compiling the project with Flang; see https://godbolt.org/z/91EfY154n

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@inaki-amatria inaki-amatria marked this pull request as ready for review September 5, 2024 10:59
this change ensures the type of `mask_val` is big enough to satisfy the
`transfer`; otherwise, we risk transfering a 4-byte value to 2-element
arrays of 4-byte elements (i.e., `i4tmp(2)` and `r4tmp(2)`)

I encountered this issue compiling the project with Flang; see
https://godbolt.org/z/91EfY154n
@inaki-amatria inaki-amatria changed the title fix: set type of mask_val fix: use a bigger real transfering mask_val Sep 5, 2024
@inaki-amatria
Copy link
Author

Bump! (I am sorry if this is not standard procedure. I just want to make sure this PR does not go unnoticed)

@bensonr
Copy link
Contributor

bensonr commented Sep 12, 2024

Can you open an issue and explain what's happening and why this is needed with example code that demonstrates the problem. Also, as you add code, we require contributors to create new or modify an existing unit test to demonstrate proper behavior of the update for our CI/CD system and manual testing. If there is an expected failure condition, the unit test should also exercise it to ensure proper handling of the failure.

@inaki-amatria
Copy link
Author

inaki-amatria commented Sep 16, 2024

After careful consideration of the issue, I believe this is an error in the latest LLVM Flang compiler. Indeed, according to https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gfortran/TRANSFER.html: "If the bitwise representation of the result is longer than that of SOURCE, then the leading bits of the result correspond to those of SOURCE and any trailing bits are filled arbitrarily.". So this seems like a Flang bug (llvm/llvm-project#108832). I am sorry about the confusion and thank you very much for your valuable time!

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.

2 participants