2017-12-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr29801.c
blob367b561e7a25f58b7e17190756b6bd1e1140eae7
1 /* We used to crash in ccp here, because the initial constant value of 2
2 was changed to 5. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2 -fdump-tree-optimized" } */
7 static const int a = 2;
9 int test (int param)
11 int *p = (int *) &a;
13 if (param)
14 *p = 5;
16 return a;
19 /* Check that we return the correct (unchanged) value. */
21 /* { dg-final { scan-tree-dump-times "return 2" 1 "optimized" } } */
22 /* { dg-final { scan-tree-dump-times "return 5" 0 "optimized" } } */