Checks
Commit Message
While I was writting a match.pd patch, I can across GCC was being miscompiled
but no testcase was failing. So this adds that testcase.
Committed after testing on x86_64 with
make check-gcc RUNTESTFLAGS="execute.exp=20230509-1.c"
gcc/testsuite/ChangeLog:
* gcc.c-torture/execute/20230509-1.c: New test.
---
.../gcc.c-torture/execute/20230509-1.c | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 gcc/testsuite/gcc.c-torture/execute/20230509-1.c
new file mode 100644
@@ -0,0 +1,28 @@
+int __attribute__((noipa)) f(unsigned a, int b)
+{
+ if (a < 0) __builtin_unreachable();
+ if (a > 30) __builtin_unreachable();
+ int t = a;
+ if (b) t = 100;
+ else if (a != 0)
+ t = a ;
+ else
+ t = 1;
+ return t;
+}
+
+
+int main(void)
+{
+ if (f(0, 0) != 1)
+ __builtin_abort();
+ if (f(1, 0) != 1)
+ __builtin_abort();
+ if (f(0, 1) != 100)
+ __builtin_abort();
+ if (f(1, 0) != 1)
+ __builtin_abort();
+ if (f(30, 0) != 30)
+ __builtin_abort();
+}
+