Add test case for PR 8646.

llvm-svn: 125401
This commit is contained in:
Ted Kremenek 2011-02-11 20:13:27 +00:00
parent 259326c821
commit 6cc8f5d83c
1 changed files with 24 additions and 3 deletions

View File

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