[committed] testsuite: Add testcase for already fixed PR [PR126576]
Jakub Jelinek <[email protected]> Mon, 3 Aug 2026 11:54:29 +0200
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <anBlVQQPTLuP8Wxm@tucnak> |
Hi! This testcase got fixed with r17-2843, but the testcase is sufficiently different from the other one that it is worth having both. Tested on x86_64-linux and i686-linux, committed to trunk as obvious. 2026-08-03 Jakub Jelinek <[email protected]> PR tree-optimization/126576 * gcc.dg/torture/pr126576.c: New test. --- gcc/testsuite/gcc.dg/torture/pr126576.c.jj 2026-08-03 11:45:31.427027382 +0200 +++ gcc/testsuite/gcc.dg/torture/pr126576.c 2026-08-03 11:46:29.331288867 +0200 @@ -0,0 +1,43 @@ +/* PR tree-optimization/126576 */ +/* { dg-do run } */ + +#if __DBL_MANT_DIG__ == 53 && __DBL_MAX_10_EXP__ == 308 \ + && __DBL_HAS_INFINITY__ && __FLT_EVAL_METHOD__ == 0 +int v; + +[[gnu::noipa]] void +bar (int x) +{ + v |= x; +} + +[[gnu::noipa]] double +foo (double x) +{ + double a = x * x; + if (__builtin_isinf (a) && !__builtin_isinf (x)) + bar (1); + double b = a * 3.0; + if (__builtin_isinf (b) && !__builtin_isinf (a)) + bar (2); + return b; +} +#endif + +int +main () +{ +#if __DBL_MANT_DIG__ == 53 && __DBL_MAX_10_EXP__ == 308 \ + && __DBL_HAS_INFINITY__ && __FLT_EVAL_METHOD__ == 0 + foo (1e154); + if (v != 2) + __builtin_abort (); + v = 0; + foo (1e152); + if (v != 0) + __builtin_abort (); + foo (1e155); + if (v != 1) + __builtin_abort (); +#endif +} Jakub