diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr41395-1.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr41395-1.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41395-1.c b/gcc/testsuite/gcc.c-torture/execute/pr41395-1.c new file mode 100644 index 000000000..e4df0e5d1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr41395-1.c @@ -0,0 +1,28 @@ +struct VEC_char_base +{ + unsigned num; + unsigned alloc; + short vec[1]; +}; + +short __attribute__((noinline)) +foo (struct VEC_char_base *p, int i) +{ + short *q; + p->vec[i] = 0; + q = &p->vec[8]; + *q = 1; + return p->vec[i]; +} + +extern void abort (void); +extern void *malloc (__SIZE_TYPE__); + +int +main() +{ + struct VEC_char_base *p = malloc (sizeof (struct VEC_char_base) + 256); + if (foo (p, 8) != 1) + abort (); + return 0; +} |