From: Jeff Law Date: Fri, 7 Nov 2014 17:02:55 +0000 (-0700) Subject: * g++.dg/pr61289-2.C: Renamed from pr61289-2.c. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82910dd63a69913d81e51d459821a77f4de2e251;p=gcc.git * g++.dg/pr61289-2.C: Renamed from pr61289-2.c. From-SVN: r217234 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dc812e05ca7..52ff7effc67 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-11-07 Jeff Law + + * g++.dg/pr61289-2.C: Renamed from pr61289-2.c. + 2014-11-07 Jiong Wang * gcc.target/arm/lp1243022.c (xhci_test_trb_in_td): Add return type. diff --git a/gcc/testsuite/g++.dg/pr61289-2.C b/gcc/testsuite/g++.dg/pr61289-2.C new file mode 100644 index 00000000000..4cc3ebe468d --- /dev/null +++ b/gcc/testsuite/g++.dg/pr61289-2.C @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-exceptions" } */ +struct S +{ + inline int fn1 () const { return s; } + __attribute__ ((noinline, noclone)) S *fn2 (int); + __attribute__ ((noinline, noclone)) void fn3 (); + __attribute__ ((noinline, noclone)) static S *fn4 (int); + S (int i) : s (i) {} + int s; +}; + +int a = 0; +S *b = 0; + +S * +S::fn2 (int i) +{ + a++; + if (a == 1) + return b; + if (a > 3) + __builtin_abort (); + b = this; + return new S (i + s); +} + +S * +S::fn4 (int i) +{ + b = new S (i); + return b; +} + +void +S::fn3 () +{ + delete this; +} + +void +foo () +{ + S *c = S::fn4 (20); + for (int i = 0; i < 2;) + { + S *d = c->fn2 (c->fn1 () + 10); + if (c != d) +{ + c->fn3 (); + c = d; + ++i; +} + } + c->fn3 (); +} + +int +main () +{ + foo (); +} diff --git a/gcc/testsuite/g++.dg/pr61289-2.c b/gcc/testsuite/g++.dg/pr61289-2.c deleted file mode 100644 index 4cc3ebe468d..00000000000 --- a/gcc/testsuite/g++.dg/pr61289-2.c +++ /dev/null @@ -1,62 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O2 -fno-exceptions" } */ -struct S -{ - inline int fn1 () const { return s; } - __attribute__ ((noinline, noclone)) S *fn2 (int); - __attribute__ ((noinline, noclone)) void fn3 (); - __attribute__ ((noinline, noclone)) static S *fn4 (int); - S (int i) : s (i) {} - int s; -}; - -int a = 0; -S *b = 0; - -S * -S::fn2 (int i) -{ - a++; - if (a == 1) - return b; - if (a > 3) - __builtin_abort (); - b = this; - return new S (i + s); -} - -S * -S::fn4 (int i) -{ - b = new S (i); - return b; -} - -void -S::fn3 () -{ - delete this; -} - -void -foo () -{ - S *c = S::fn4 (20); - for (int i = 0; i < 2;) - { - S *d = c->fn2 (c->fn1 () + 10); - if (c != d) -{ - c->fn3 (); - c = d; - ++i; -} - } - c->fn3 (); -} - -int -main () -{ - foo (); -}