aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-11 20:13:27 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-11 20:13:27 +0000
commitac518ecd5204116eb976c8d77ccf2dd2c7352148 (patch)
tree41e05d4a1b980705018db2c7c298682a19abef7f
parente2f82f71385051ce5abfba317d2f592aa332c588 (diff)
Add test case for PR 8646.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125401 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/misc-ps.m27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index 029ca70d28..f00228466f 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -822,7 +822,7 @@ struct trie {
struct kwset {
struct trie *trie;
- unsigned char delta[10];
+ unsigned char y[10];
struct trie* next[10];
int d;
};
@@ -837,9 +837,9 @@ void f(kwset_t *kws, char const *p, char const *q) {
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 @@ void pr8619(int a, int b, int c) {
}
+// 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;
+}