gcc/testsuite/gcc.dg/torture/pr115199.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | struct b { |
| 4 | char *volatile c; |
| 5 | }; |
| 6 | struct b * __attribute__((noipa)) |
| 7 | d() |
| 8 | { |
| 9 | char *e; |
| 10 | struct b *b = __builtin_malloc(sizeof(b)); |
| 11 | void *f = __builtin_malloc(1); |
| 12 | |
| 13 | e = __builtin_memcpy(f, "z", 1); |
| 14 | b->c = e; |
| 15 | return b; |
| 16 | } |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | struct b b = *d(); |
| 21 | if (b.c[0] != 'z') |
| 22 | __builtin_abort(); |
| 23 | return 0; |
| 24 | } |