-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[flang] Fix bogus warning about missing FINAL on assumed-rank #66250
Merged
Conversation
This file contains 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
The warning message about a derived type not having a FINAL subroutine for a particular object's rank should not issue for an assumed-rank dummy argument. Pull request: llvm#66250
llvmbot
added
flang
Flang issues not falling into any other category
flang:semantics
labels
Sep 13, 2023
@llvm/pr-subscribers-flang-semantics ChangesThe warning message about a derived type not having a FINAL subroutine for a particular object's rank should not issue for an assumed-rank dummy argument. -- Full diff: https://github.com//pull/66250.diff2 Files Affected:
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp index e7e091ed024c48d..f76e69726cbf95b 100644 --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -2052,7 +2052,7 @@ bool CheckHelper::CheckConflicting(const Symbol &symbol, Attr a1, Attr a2) { void CheckHelper::WarnMissingFinal(const Symbol &symbol) { const auto *object{symbol.detailsIf<ObjectEntityDetails>()}; - if (!object || + if (!object || object->IsAssumedRank() || (!IsAutomaticallyDestroyed(symbol) && symbol.owner().kind() != Scope::Kind::DerivedType)) { return; diff --git a/flang/test/Semantics/final02.f90 b/flang/test/Semantics/final02.f90 index b474f45ee5c327b..bea8f1b87ef5f6f 100644 --- a/flang/test/Semantics/final02.f90 +++ b/flang/test/Semantics/final02.f90 @@ -25,6 +25,11 @@ module m !CHECK: 'matrix' of derived type 't1' does not have a FINAL subroutine for its rank (2) type(t1) :: matrix(2, 2) end type + type :: t6 + integer :: n + contains + final :: t6f3 + end type contains subroutine t1f0(x) type(t1) :: x @@ -38,9 +43,12 @@ impure elemental subroutine t2fe(x) subroutine t3far(x) type(t3) :: x(..) end subroutine + subroutine t6f3(x) + type(t6) :: x(:,:,:) + end subroutine end module -subroutine test ! *not* a main program, since they don't finalize locals +subroutine test(assumedRank) ! *not* a main program, since they don't finalize locals use m !CHECK-NOT: 'scalar1' of derived type 't1' type(t1) :: scalar1 @@ -66,4 +74,6 @@ subroutine test ! *not* a main program, since they don't finalize locals type(t4) :: vector4(2) !CHECK: 'matrix4' of derived type 't4' extended from 't1' does not have a FINAL subroutine for its rank (2) type(t4) :: matrix4(2,2) + !CHECK-NOT: 'assumedRank' of derived type 't6' + type(t6) :: assumedRank(..) end |
vzakhari
approved these changes
Sep 13, 2023
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.
Thanks!
ZijunZhaoCCK
pushed a commit
to ZijunZhaoCCK/llvm-project
that referenced
this pull request
Sep 19, 2023
…6250) The warning message about a derived type not having a FINAL subroutine for a particular object's rank should not issue for an assumed-rank dummy argument.
zahiraam
pushed a commit
to tahonermann/llvm-project
that referenced
this pull request
Oct 24, 2023
…6250) The warning message about a derived type not having a FINAL subroutine for a particular object's rank should not issue for an assumed-rank dummy argument.
zahiraam
pushed a commit
to tahonermann/llvm-project
that referenced
this pull request
Oct 24, 2023
…6250) The warning message about a derived type not having a FINAL subroutine for a particular object's rank should not issue for an assumed-rank dummy argument.
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.
The warning message about a derived type not having a FINAL subroutine for a particular object's rank should not issue for an assumed-rank dummy argument.