178201Sdd/* We used to crash in ccp here, because the initial constant value of 2
278201Sdd   was changed to 5.  */
31590Srgrimes
41590Srgrimes/* { dg-do compile } */
51590Srgrimes/* { dg-options "-O2 -fdump-tree-optimized" } */
6226361Sed
7201386Sedstatic const int a = 2;
81590Srgrimes
9int test (int param)
10{
11  int *p = (int *) &a;
12
13  if (param)
14    *p = 5;
15
16  return a;
17}
18
19/* Check that we return the correct (unchanged) value.  */
20
21/* { dg-final { scan-tree-dump-times "return 2" 1 "optimized" } } */
22/* { dg-final { scan-tree-dump-times "return 5" 0 "optimized" } } */
23
24/* { dg-final { cleanup-tree-dump "optimized" } } */
25