aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/18-goto2.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/18-goto2.c b/test/18-goto2.c
new file mode 100644
index 0000000..8742d35
--- /dev/null
+++ b/test/18-goto2.c
@@ -0,0 +1,24 @@
+/* EXPECT:
+ok
+*/
+
+void h(int x){}
+
+/* isolated mem2reg bug from something in regalloc: the goto into the loop past
+ * the `int nqueue` declaration caused a miscompilation */
+void test(void) {
+ int curi = 5;
+ goto start2;
+ for (curi; curi >= 0; curi--) {
+ int nqueue;
+ start2:
+ for (nqueue = 2; nqueue > 0; ) {
+ h(nqueue--);
+ }
+ }
+}
+int puts(const char *);
+int main(void) {
+ test();
+ puts("ok");
+}