mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
Adds a Java assembly test case for issue #2995 which was resolved in #2996
This commit is contained in:
@@ -175,4 +175,8 @@ describe('javap parsing', () => {
|
|||||||
testJava('test/java/two-classes', 'ASecondClass', 'ZFirstClass'),
|
testJava('test/java/two-classes', 'ASecondClass', 'ZFirstClass'),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Properly parses lookupswitch blocks', () => {
|
||||||
|
return testJava('test/java/lookupswitch-bug-2995', 'Main');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
37
test/java/lookupswitch-bug-2995/Main.asm
generated
Normal file
37
test/java/lookupswitch-bug-2995/Main.asm
generated
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
Compiled from "example.java"
|
||||||
|
class Main {
|
||||||
|
Main();
|
||||||
|
Code:
|
||||||
|
0: aload_0
|
||||||
|
1: invokespecial #1 // Method java/lang/Object."<init>":()V
|
||||||
|
4: return
|
||||||
|
LineNumberTable:
|
||||||
|
line 1: 0
|
||||||
|
|
||||||
|
static void test(int);
|
||||||
|
Code:
|
||||||
|
0: iload_0
|
||||||
|
1: lookupswitch { // 2
|
||||||
|
0: 28
|
||||||
|
1: 38
|
||||||
|
default: 49
|
||||||
|
}
|
||||||
|
28: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream;
|
||||||
|
31: iconst_1
|
||||||
|
32: invokevirtual #13 // Method java/io/PrintStream.println:(I)V
|
||||||
|
35: goto 57
|
||||||
|
38: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream;
|
||||||
|
41: bipush 12
|
||||||
|
43: invokevirtual #13 // Method java/io/PrintStream.println:(I)V
|
||||||
|
46: goto 57
|
||||||
|
49: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream;
|
||||||
|
52: ldc #19 // String default
|
||||||
|
54: invokevirtual #21 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
|
||||||
|
57: return
|
||||||
|
LineNumberTable:
|
||||||
|
line 3: 0
|
||||||
|
line 4: 28
|
||||||
|
line 5: 38
|
||||||
|
line 6: 49
|
||||||
|
line 8: 57
|
||||||
|
}
|
||||||
9
test/java/lookupswitch-bug-2995/input.java
Normal file
9
test/java/lookupswitch-bug-2995/input.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class Main {
|
||||||
|
static void test(int x) {
|
||||||
|
switch (x) {
|
||||||
|
case 0: System.out.println(1); break;
|
||||||
|
case 1: System.out.println(12); break;
|
||||||
|
default: System.out.println("default");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
test/java/lookupswitch-bug-2995/output.asm
generated
Normal file
28
test/java/lookupswitch-bug-2995/output.asm
generated
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
class Main {
|
||||||
|
Main();
|
||||||
|
line 1: 0: aload_0
|
||||||
|
line 1: 1: invokespecial #1 // Method java/lang/Object."<init>":()V
|
||||||
|
line 1: 4: return
|
||||||
|
|
||||||
|
|
||||||
|
static void test(int);
|
||||||
|
line 3: 0: iload_0
|
||||||
|
line 3: 1: lookupswitch { // 2
|
||||||
|
line 3: 0: 28
|
||||||
|
line 3: 1: 38
|
||||||
|
line 3: default: 49
|
||||||
|
line 3: }
|
||||||
|
line 4: 28: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream;
|
||||||
|
line 4: 31: iconst_1
|
||||||
|
line 4: 32: invokevirtual #13 // Method java/io/PrintStream.println:(I)V
|
||||||
|
line 4: 35: goto 57
|
||||||
|
line 5: 38: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream;
|
||||||
|
line 5: 41: bipush 12
|
||||||
|
line 5: 43: invokevirtual #13 // Method java/io/PrintStream.println:(I)V
|
||||||
|
line 5: 46: goto 57
|
||||||
|
line 6: 49: getstatic #7 // Field java/lang/System.out:Ljava/io/PrintStream;
|
||||||
|
line 6: 52: ldc #19 // String default
|
||||||
|
line 6: 54: invokevirtual #21 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
|
||||||
|
line 8: 57: return
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user