[cfe-commits] r125401 - /cfe/trunk/test/Analysis/misc-ps.m

Ted Kremenek kremenek at apple.com
Fri Feb 11 12:13:27 PST 2011


Author: kremenek
Date: Fri Feb 11 14:13:27 2011
New Revision: 125401

URL: http://llvm.org/viewvc/llvm-project?rev=125401&view=rev
Log:
Add test case for PR 8646.

Modified:
    cfe/trunk/test/Analysis/misc-ps.m

Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=125401&r1=125400&r2=125401&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Fri Feb 11 14:13:27 2011
@@ -822,7 +822,7 @@
 
 struct kwset {
   struct trie *trie;
-  unsigned char delta[10];
+  unsigned char y[10];
   struct trie* next[10];
   int d;
 };
@@ -837,9 +837,9 @@
   register char const *end = p;
   register char const *lim = q;
   register int d = 1;
-  register unsigned char const *delta = kws->delta;
+  register unsigned char const *y = kws->y;
 
-  d = delta[c = (end+=d)[-1]]; // no-warning
+  d = y[c = (end+=d)[-1]]; // no-warning
   trie = next[c];
 }
 
@@ -1212,3 +1212,24 @@
 }
 
 
+// PR 8646 - crash in the analyzer when handling unions.
+union pr8648_union {
+        signed long long pr8648_union_field;
+};
+void pr8648() {
+  long long y;
+  union pr8648_union x = { .pr8648_union_field = 0LL };
+  y = x.pr8648_union_field;
+  
+  union pr8648_union z;
+  z = (union pr8648_union) { .pr8648_union_field = 0LL };
+
+  union pr8648_union w;
+  w = ({ (union pr8648_union) { .pr8648_union_field = 0LL }; }); 
+
+  // crash, no assignment
+  (void) ({ (union pr8648_union) { .pr8648_union_field = 0LL }; }).pr8648_union_field;
+
+  // crash with assignment
+  y = ({ (union pr8648_union) { .pr8648_union_field = 0LL }; }).pr8648_union_field;
+}





More information about the cfe-commits mailing list