aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/cxx-uninitialized-object.cpp
diff options
context:
space:
mode:
authorKristof Umann <kristof.umann@ericsson.com>2019-04-30 08:47:56 +0000
committerKristof Umann <kristof.umann@ericsson.com>2019-04-30 08:47:56 +0000
commitbbce6781086684deafc9a99d1f9bc6783aa70787 (patch)
tree867afc3ed5232b95cfb4dec5cb5b754ba6c10a75 /test/Analysis/cxx-uninitialized-object.cpp
parentc208eda5d902a10fcbc85024a06a60f72fbed767 (diff)
[analyzer][UninitializedObjectChecker] PR41611: Regard vector types as primitive
https://bugs.llvm.org/show_bug.cgi?id=41611 Similarly to D61106, the checker ran over an llvm_unreachable for vector types: struct VectorSizeLong { VectorSizeLong() {} __attribute__((__vector_size__(16))) long x; }; void __vector_size__LongTest() { VectorSizeLong v; } Since, according to my short research, "The vector_size attribute is only applicable to integral and float scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct." [src: https://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Vector-Extensions.html#Vector-Extensions] vector types are safe to regard as primitive. Differential Revision: https://reviews.llvm.org/D61246 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/cxx-uninitialized-object.cpp')
-rw-r--r--test/Analysis/cxx-uninitialized-object.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/Analysis/cxx-uninitialized-object.cpp b/test/Analysis/cxx-uninitialized-object.cpp
index 86f2ecdd83..a811319854 100644
--- a/test/Analysis/cxx-uninitialized-object.cpp
+++ b/test/Analysis/cxx-uninitialized-object.cpp
@@ -1132,7 +1132,7 @@ void fCXX11MemberInitTest2() {
}
//===----------------------------------------------------------------------===//
-// _Atomic tests.
+// "Esoteric" primitive type tests.
//===----------------------------------------------------------------------===//
struct MyAtomicInt {
@@ -1142,6 +1142,17 @@ struct MyAtomicInt {
MyAtomicInt() {} // expected-warning{{1 uninitialized field}}
};
-void entry() {
+void _AtomicTest() {
MyAtomicInt b;
}
+
+struct VectorSizeLong {
+ VectorSizeLong() {}
+ __attribute__((__vector_size__(16))) long x;
+};
+
+void __vector_size__LongTest() {
+ // TODO: Warn for v.x.
+ VectorSizeLong v;
+ v.x[0] = 0;
+}