Skip to content

[analyzer][NFC] Add a test case to PR-70792 for Issue-59493 #71073

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 2 commits into from
Nov 3, 2023

Conversation

Snape3058
Copy link
Member

Following PR #70792 for issue #70464
Add a test case for issue #59493

@Snape3058 Snape3058 requested a review from steakhal November 2, 2023 16:10
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html labels Nov 2, 2023
@llvmbot
Copy link
Member

llvmbot commented Nov 2, 2023

@llvm/pr-subscribers-clang

Author: Ella Ma (Snape3058)

Changes

Following PR #70792 for issue #70464
Add a test case for issue #59493


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

1 Files Affected:

  • (modified) clang/test/Analysis/issue-70464.cpp (+20)
diff --git a/clang/test/Analysis/issue-70464.cpp b/clang/test/Analysis/issue-70464.cpp
index f3b3072eb919823..331068775821e7e 100644
--- a/clang/test/Analysis/issue-70464.cpp
+++ b/clang/test/Analysis/issue-70464.cpp
@@ -66,3 +66,23 @@ struct Derived : Base {
 void entry() { Derived test; }
 
 } // namespace delegate_ctor_call
+
+// Additional test case from issue #59493
+namespace init_list_array {
+
+struct Base {
+  int foox[1];
+};
+
+class Derived : public Base {
+public:
+  Derived() : Base{{42}} {
+    // The dereference to this->foox below should be initialized properly.
+    clang_analyzer_dump(this->foox[0]); // expected-warning{{42 S32b}}
+    clang_analyzer_dump(foox[0]); // expected-warning{{42 S32b}}
+  }
+};
+
+void entry() { Derived test; }
+
+} // namespace init_list_array

@steakhal steakhal changed the title [clang][analyzer] Add a test case to PR-70792 for Issue-59493 [analyzer][NFC] Add a test case to PR-70792 for Issue-59493 Nov 2, 2023
Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

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

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants