Conversation
Allow for renaming in USE association of Cray pointers. Fixes llvm#148559.
Member
|
@llvm/pr-subscribers-flang-semantics Author: Peter Klausler (klausler) ChangesAllow for renaming in USE association of Cray pointers. Fixes #148559. Full diff: https://github.com/llvm/llvm-project/pull/148706.diff 2 Files Affected:
diff --git a/flang/lib/Semantics/tools.cpp b/flang/lib/Semantics/tools.cpp
index 5e5b43f26c791..5a5b02e1ac3ce 100644
--- a/flang/lib/Semantics/tools.cpp
+++ b/flang/lib/Semantics/tools.cpp
@@ -348,9 +348,9 @@ const Symbol &BypassGeneric(const Symbol &symbol) {
const Symbol &GetCrayPointer(const Symbol &crayPointee) {
const Symbol *found{nullptr};
- for (const auto &[pointee, pointer] :
- crayPointee.GetUltimate().owner().crayPointers()) {
- if (pointee == crayPointee.name()) {
+ const Symbol &ultimate{crayPointee.GetUltimate()};
+ for (const auto &[pointee, pointer] : ultimate.owner().crayPointers()) {
+ if (pointee == ultimate.name()) {
found = &pointer.get();
break;
}
diff --git a/flang/test/Semantics/bug148559.f90 b/flang/test/Semantics/bug148559.f90
new file mode 100644
index 0000000000000..d7b959ac8f191
--- /dev/null
+++ b/flang/test/Semantics/bug148559.f90
@@ -0,0 +1,12 @@
+!RUN: %flang_fc1 -fsyntax-only %s
+!Regression test for crash in semantics on Cray pointers
+
+module m
+ pointer(ptr,pp)
+end module m
+
+program main
+ use m, only:renamea=>pp
+ use m, only:pp
+ print *, renamea
+end
|
eugeneepshteyn
approved these changes
Jul 14, 2025
akuhlens
approved these changes
Jul 14, 2025
This was referenced Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow for renaming in USE association of Cray pointers.
Fixes #148559.