From: Jakub Jelinek Date: Thu, 15 Jan 2026 06:46:24 +0000 (+0100) Subject: testsuite: Add testcase for already fixed PR [PR120322] X-Git-Tag: basepoints/gcc-17~2010 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=b12d834aab36fc7fafa15fc1ad00f5b0bc80bd3d;p=thirdparty%2Fgcc.git testsuite: Add testcase for already fixed PR [PR120322] This testcase started to be miscompiled with r16-170 and got fixed again with r16-960. 2026-01-15 Jakub Jelinek PR tree-optimization/120322 * gcc.dg/torture/pr120322.c: New test. --- diff --git a/gcc/testsuite/gcc.dg/torture/pr120322.c b/gcc/testsuite/gcc.dg/torture/pr120322.c new file mode 100644 index 00000000000..8697c28c9ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120322.c @@ -0,0 +1,33 @@ +/* PR tree-optimization/120322 */ +/* { dg-do run } */ +/* { dg-additional-options "-fno-early-inlining" } */ + +int a, b, c; + +void +foo (int e) +{ + if (e > 0) + while (b) + ; +} + +void +bar (unsigned short e) +{ + foo (e); +} + +static void +baz (short e) +{ + bar (e); + c = a; +} + +int +main () +{ + if (sizeof (int) > sizeof (short)) + baz (-1); +}