view gcc/testsuite/g++.dg/pr64191.C @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { dg-do compile }
// { dg-options "-O2 -fdump-tree-cddce1" }

struct Bar
{
  int i;
  ~Bar() { }
};
void bar_dtor_loop(Bar* p, unsigned int n)
{
  if (p) {
      Bar* e = p + n;
      while (e > p) {
	  --e;
	  e->~Bar();
      }
  }
}

// The clobber in ~Bar should persist but those inlined into
// bar_dtor_loop not, nor should the loop therein

// { dg-final { scan-tree-dump-times "CLOBBER" 1 "cddce1" } }
// { dg-final { scan-tree-dump-times "if" 0 "cddce1" } }