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 aliased string move interface #773

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

perazz
Copy link
Member

@perazz perazz commented Mar 14, 2024

Fixes #744 (previous fix: #736)

The following line is causing a segfault on macOS, gfortran 13.2.0, hence failed test:

call move(from_string, from_string)

I believe this line is invalid Fortran because it violates the no-alising rule: two dummy arguments passed by reference cannot point to the same address. So probably, gfortran optimizes out the temporary variable which then causes trouble.

My proposed solution is to check the address first, and avoid the dangerous operation if the variable is the same.

cc: @Pranavchiku @wpbonelli @jvdp1 @awvwgk

Copy link
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

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

That's a great usage of pointer association and targets. I think we can work with that.

Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

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

Nice solution! Thank you @perazz

@perazz
Copy link
Member Author

perazz commented Mar 15, 2024

Thank you Sebastian and Jeremie, I'm going to wait another few days, then merge if there are no more comments.

@perazz perazz merged commit 7211ce8 into fortran-lang:master Mar 18, 2024
17 checks passed
@perazz perazz deleted the fix_macos_failed_tests branch April 26, 2024 10:34
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.

string_intrinsic (Subprocess aborted) failed
3 participants