gcc/testsuite/gcc.dg/uninit-pr65686.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -Wall -fdump-tree-optimized" } */ |
| 3 | |
| 4 | typedef unsigned mytype; |
| 5 | |
| 6 | struct S { |
| 7 | mytype *pu; |
| 8 | }; |
| 9 | |
| 10 | mytype f(struct S *e) |
| 11 | { |
| 12 | mytype x; /* { dg-bogus { "uninitialized" } } */ |
| 13 | if(&x != e->pu) |
| 14 | __builtin_memcpy(&x, e->pu, sizeof(unsigned)); |
| 15 | return x; |
| 16 | } |
| 17 | |
| 18 | /* { dg-final { scan-tree-dump-not "if" "optimized" } } */ |