From: Andrew Pinski Date: Wed, 10 May 2023 05:02:48 +0000 (+0000) Subject: New testcase X-Git-Tag: basepoints/gcc-15~9493 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ef0ebf901f6299e76237777e1b72b65c795fac0;p=thirdparty%2Fgcc.git New testcase 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. --- diff --git a/gcc/testsuite/gcc.c-torture/execute/20230509-1.c b/gcc/testsuite/gcc.c-torture/execute/20230509-1.c new file mode 100644 index 000000000000..359d93c5d34c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20230509-1.c @@ -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(); +} +