Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.old-deja/g++.other/loop1.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 |
rev | line source |
---|---|
111 | 1 // { dg-do run } |
2 // { dg-options "-O2" } | |
3 // Test for bad loop optimization of goto fixups. | |
4 | |
5 typedef bool (*ftype) (); | |
6 | |
7 int c, d; | |
8 struct A { | |
9 A() { ++c; } | |
10 A(const A&) { ++c; } | |
11 ~A() { ++d; } | |
12 }; | |
13 | |
14 void f (ftype func) | |
15 { | |
16 A a; | |
17 do { | |
18 if ((*func)()) return; | |
19 } while (true); | |
20 } | |
21 | |
22 bool test () | |
23 { | |
24 return true; | |
25 } | |
26 | |
131 | 27 int |
111 | 28 main () |
29 { | |
30 f (test); | |
31 return (c != d); | |
32 } |