1  /* PR rtl-optimization/36017 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O2" } */
       4  
       5  #if defined (__AVR__) && (__SIZEOF_DOUBLE__ == __SIZEOF_FLOAT__)
       6  extern double sqrt (double) __asm ("sqrtf");
       7  #else
       8  extern double sqrt (double);
       9  #endif
      10  extern void abort (void);
      11  
      12  __attribute__((noinline)) double
      13  foo (double a)
      14  {
      15    double b, c, d = 0.7;
      16    if (a <= d)
      17      b = sqrt (d * a);
      18    else
      19      {
      20        c = (1.0 - d) * (1.0 - a);
      21        b = c > 0 ? 1.0 - sqrt (c) : 1.0;
      22      }
      23    return b;
      24  }
      25  
      26  int
      27  main (void)
      28  {
      29    double c = foo (0.5);
      30    if (c > 0.5917)
      31      abort ();
      32    return 0;
      33  }