aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/goto.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-29 09:59:30 +0200
committerlemon <lsof@mailbox.org>2023-06-29 09:59:30 +0200
commitf453b313f62ba42d748f00628be7b3750c797c86 (patch)
treee654029d425dee2adf30c0fa2adba31d0266db1c /test/goto.c
parent3b96204593b9812674126bad8de14419009682c8 (diff)
add initializers (only static for initialier list rn)
and other fixes
Diffstat (limited to 'test/goto.c')
-rw-r--r--test/goto.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/goto.c b/test/goto.c
new file mode 100644
index 0000000..0ecbf28
--- /dev/null
+++ b/test/goto.c
@@ -0,0 +1,25 @@
+int crz(int x) {
+/* x <<= 1; while (x < 0) ++x; return x; */
+ goto e;
+a:
+ return x;
+j:
+ ++x;
+ goto q;
+b:
+ if (x < 0)
+ goto j;
+ goto a;
+q:
+ goto b;
+e:
+ x <<= 1;
+ goto b;
+}
+
+int printf(const char *, ...);
+int main() {
+ printf("should print 14: %d\n", crz(7));
+ printf("should print 0: %d\n", crz(-3));
+ printf("should print 0: %d\n", crz(0));
+}