view gcc/testsuite/g++.dg/tree-ssa/pr31146-2.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-O -fcheck-new -fno-tree-vrp -fdump-tree-forwprop1" } */

#include <new>

template <class T>
struct Vec
{
  Vec()
  {
    for (int i=0; i<3; ++i)
      new (&a[i]) T(0);
  }
  T a[3];
};

double foo (void)
{
  Vec<double> v;
  return v.a[2];
}

/* GCC 8 emits operator new () != NULL with -fcheck-new. */
/* { dg-final { scan-tree-dump "Replaced .* != 0B. with .1" "forwprop1" } } */