Skip to content

[flang] Fix "suspicious condition" in C++ usage #82790

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

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

klausler
Copy link
Contributor

Address a reported C++ coding "suspicious condition".

Fixes #80807.

Address a reported C++ coding "suspicious condition".

Fixes llvm#80807.
@klausler klausler requested a review from psteinfeld February 23, 2024 16:47
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Feb 23, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 23, 2024

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

Changes

Address a reported C++ coding "suspicious condition".

Fixes #80807.


Full diff: https://github.com/llvm/llvm-project/pull/82790.diff

1 Files Affected:

  • (modified) flang/lib/Semantics/data-to-inits.cpp (+1-1)
diff --git a/flang/lib/Semantics/data-to-inits.cpp b/flang/lib/Semantics/data-to-inits.cpp
index c12af1bb0165cd..fa22d498679053 100644
--- a/flang/lib/Semantics/data-to-inits.cpp
+++ b/flang/lib/Semantics/data-to-inits.cpp
@@ -524,7 +524,7 @@ static const DerivedTypeSpec *HasDefaultInitialization(const Symbol &symbol) {
                 directs.begin(), directs.end(), [](const Symbol &component) {
                   return !IsAllocatable(component) &&
                       HasDeclarationInitializer(component);
-                })) {
+                }) != directs.end()) {
           return derived;
         }
       }

Copy link
Contributor

@psteinfeld psteinfeld left a comment

Choose a reason for hiding this comment

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

All builds and tests correctly and looks good.

@klausler klausler merged commit e8a9aa2 into llvm:main Mar 1, 2024
@klausler klausler deleted the bug80807 branch March 1, 2024 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flang/lib/Semantics/data-to-inits.cpp:523:Suspicious condition
3 participants