1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -fdump-tree-dse1" } */
       3  
       4  int
       5  foo (int a, int b, int c)
       6  {
       7    int *p;
       8    if (c)
       9      p = &a;
      10    else
      11      p = &b;
      12  
      13    *p = 3;
      14    *p = 4;
      15    return *p;
      16  }
      17  
      18  
      19  /* We should eliminate both assignments to *p.  */
      20  /* { dg-final { scan-tree-dump-times " = 3" 0 "dse1"} } */
      21  /* { dg-final { scan-tree-dump-times " = 4" 0 "dse1"} } */
      22  
      23  /* The return *p should be turned into return 4.  */
      24  /* { dg-final { scan-tree-dump-times " return 4" 1 "dse1"} } */
      25