view gcc/testsuite/g++.dg/opt/pr50682.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR tree-optimization/50682
// { dg-do compile }
// { dg-options "-O2 -fnon-call-exceptions -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" }

void foo () __attribute__ ((__noreturn__));
int baz ();

const int &
bar (const int &x, const int &y)
{
  if (x >= y)
    return y;
  return x;
}

int a, b;

struct S
{
  ~S ();
  bool m ()
  {
    int l = bar (a, b);
    int r = baz ();
    if (r)
        r = l;
      return r;
  }
};

void
test ()
{
  S s;
  if (!s.m ())
    foo ();
  if (!s.m ())
    foo ();
}