[gcc r17-2895] testsuite: Add testcase for already fixed PR [PR126576]
Jakub Jelinek via Gcc-cvs <[email protected]> Mon, 3 Aug 2026 09:53:35 +0000 (GMT)
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:04e3459dfc6ecd1138ec6d4f0d1e6b9044576814 commit r17-2895-g04e3459dfc6ecd1138ec6d4f0d1e6b9044576814 Author: Jakub Jelinek <[email protected]> Date: Mon Aug 3 11:50:20 2026 +0200 testsuite: Add testcase for already fixed PR [PR126576] This testcase got fixed with r17-2843, but the testcase is sufficiently different from the other one that it is worth having both. 2026-08-03 Jakub Jelinek <[email protected]> PR tree-optimization/126576 * gcc.dg/torture/pr126576.c: New test. Diff: --- gcc/testsuite/gcc.dg/torture/pr126576.c | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/gcc/testsuite/gcc.dg/torture/pr126576.c b/gcc/testsuite/gcc.dg/torture/pr126576.c new file mode 100644 index 000000000000..c94c74370357 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr126576.c @@ -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 +}