view gcc/testsuite/g++.dg/ipa/pr63574.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

/* { dg-do compile } */
/* { dg-options "-O3" } */

class test
{
public:
  test (int val, int *p)
  {
    int_val = *p;
    bool_val = (val != int_val);
  }

  ~test ()
  {
    if (!bool_val)
      return;
  }

  int get_int_val () const
  {
    return int_val;
  }

private:
  bool bool_val;
  int int_val;
};

static int __attribute__ ((noinline))
f1 (int i, int *p)
{
  test obj (i, p);
  return obj.get_int_val ();
}

static int __attribute__ ((noinline))
f2 (int i, int *p)
{
  test obj (i, p);
  return obj.get_int_val ();
}

int
f (int i, int *p)
{
  return f1 (i, p) + f2 (i, p);
}