Skip to content

Commit cfbe2ac

Browse files
committed
Add goto-destructor test
This checks that (a) the loop iterator 'i' gets killed before function exit and (b) there aren't too may basic blocks (indicated by 'GOTO 10' appearing, which would indicate the second loop's guarded goto statements are being unnecessarily disrupted. (For example, producing 'if(j==5) goto 2; goto end; 2: ...' instead of the simpler 'if(j==5) goto end; ...', which is necessary for the i-loop to accomodate the 'dead i;' statement, but not for the j-loop)
1 parent ea16fd4 commit cfbe2ac

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
443 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
public class Break {
3+
4+
public static void main() {
5+
6+
int j = 0;
7+
++j;
8+
for(int i = 0; i < 10; ++i)
9+
if(i == 5) break;
10+
for(j = 0; j < 10; ++j)
11+
if(j == 5) break;
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Break.class
3+
--show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
dead i;
7+
--
8+
GOTO 10

0 commit comments

Comments
 (0)