aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/external/c-testsuite/tests/single-exec/00143.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-13 19:21:04 +0100
committerlemon <lsof@mailbox.org>2025-12-13 19:21:04 +0100
commite51ac7ec7d3e32e1771c9f824da3dc7e4dcd2bc5 (patch)
treea0b7a0c29247374b96fdbfb29bc365d15e9e36a5 /test/external/c-testsuite/tests/single-exec/00143.c
parent6c7cdc537b7b341f9ca25a3e8b61de46c99840e7 (diff)
add c-testsuite
Diffstat (limited to 'test/external/c-testsuite/tests/single-exec/00143.c')
-rw-r--r--test/external/c-testsuite/tests/single-exec/00143.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/external/c-testsuite/tests/single-exec/00143.c b/test/external/c-testsuite/tests/single-exec/00143.c
new file mode 100644
index 0000000..12f33c9
--- /dev/null
+++ b/test/external/c-testsuite/tests/single-exec/00143.c
@@ -0,0 +1,37 @@
+/* Disgusting, no? But it compiles and runs just fine. I feel a combination of
+ pride and revulsion at this discovery. If no one's thought of it before,
+ I think I'll name it after myself.
+ It amazes me that after 10 years of writing C there are still
+ little corners that I haven't explored fully.
+ - Tom Duff */
+
+int main()
+{
+ int count, n;
+ short *from, *to;
+ short a[39], b[39];
+
+ for(n = 0; n < 39; n++) {
+ a[n] = n;
+ b[n] = 0;
+ }
+ from = a;
+ to = b;
+ count = 39;
+ n = (count + 7) / 8;
+ switch (count % 8) {
+ case 0: do { *to++ = *from++;
+ case 7: *to++ = *from++;
+ case 6: *to++ = *from++;
+ case 5: *to++ = *from++;
+ case 4: *to++ = *from++;
+ case 3: *to++ = *from++;
+ case 2: *to++ = *from++;
+ case 1: *to++ = *from++;
+ } while (--n > 0);
+ }
+ for(n = 0; n < 39; n++)
+ if(a[n] != b[n])
+ return 1;
+ return 0;
+} \ No newline at end of file