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

2023-11-02 Thread via cfe-commits

llvmbot wrote:




@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
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

``




https://github.com/llvm/llvm-project/pull/71073
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-11-02 Thread Balazs Benics via cfe-commits

https://github.com/steakhal edited 
https://github.com/llvm/llvm-project/pull/71073
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-11-02 Thread Balazs Benics via cfe-commits

https://github.com/steakhal requested changes to this pull request.


https://github.com/llvm/llvm-project/pull/71073
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-11-02 Thread Balazs Benics via cfe-commits


@@ -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];

steakhal wrote:

I'd suggest a more realistic array size for the test and also test some of the 
subsequent elements, including zero initialized elements.

https://github.com/llvm/llvm-project/pull/71073
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2023-11-02 Thread Ella Ma via cfe-commits

https://github.com/Snape3058 created 
https://github.com/llvm/llvm-project/pull/71073

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

>From 90d72a1f1036d2486e66c5ec16c3a8dc4241fc00 Mon Sep 17 00:00:00 2001
From: Ella Ma 
Date: Thu, 2 Nov 2023 23:14:15 +0800
Subject: [PATCH] [clang][analyzer] Add a test case to PR-70792 for Issue-59493

---
 clang/test/Analysis/issue-70464.cpp | 20 
 1 file changed, 20 insertions(+)

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

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits