From: Jakub Jelinek Date: Thu, 8 Jan 2026 08:47:38 +0000 (+0100) Subject: testsuite: Add testcase for already fixed test [PR121675] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07da32d7e64673771ce121caf8dce24db510d8ff;p=thirdparty%2Fgcc.git testsuite: Add testcase for already fixed test [PR121675] This test was miscompiled due to stale REG_UNUSED vs. single_set, fixed with r16-6062-ge1b8d097297. 2026-01-08 Jakub Jelinek PR rtl-optimization/121675 * gcc.dg/pr121675.c: New test. --- diff --git a/gcc/testsuite/gcc.dg/pr121675.c b/gcc/testsuite/gcc.dg/pr121675.c new file mode 100644 index 00000000000..96b6bd96226 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr121675.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/121675 */ +/* { dg-do run { target int32plus } } */ +/* { dg-options "-O3" } */ + +int a, c, d, e; + +int +foo (volatile int f, int g) +{ + f = -2; + if (!f) + a = 1; + c = 11 / f - g + 2; + g = c + 2; + if (!(1 / c + (g - 1))) + a = 1; + return a + f; +} + +int +main () +{ + do + { + e = (foo (1, -1) - 30885397) % 2 - 3; + d = foo (1, -1) - 1430885400; + } + while (a + 1 == 0); + if (d + e != -1430885406) + __builtin_abort (); + return 0; +}