[gcc r16-7169] tree-optimization/109410 - ICE with noreturn and -g
Richard Biener
rguenth@gcc.gnu.org
Fri Jan 30 06:59:22 GMT 2026
https://gcc.gnu.org/g:4fe48225fa4e263b8d77d7a1465e1214d9cc742c
commit r16-7169-g4fe48225fa4e263b8d77d7a1465e1214d9cc742c
Author: Richard Biener <rguenther@suse.de>
Date: Thu Jan 29 15:43:01 2026 +0100
tree-optimization/109410 - ICE with noreturn and -g
This fixes the -g variant of the original testcase.
PR tree-optimization/109410
* tree-ssa-reassoc.cc (build_and_add_sum): Use
gsi_start_nondebug_after_labels_bb to look for a possible
returns-twice call.
* gcc.dg/pr109410-2.c: New testcase.
Diff:
---
gcc/testsuite/gcc.dg/pr109410-2.c | 5 +++++
gcc/tree-ssa-reassoc.cc | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/pr109410-2.c b/gcc/testsuite/gcc.dg/pr109410-2.c
new file mode 100644
index 000000000000..9dd8d0943c56
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr109410-2.c
@@ -0,0 +1,5 @@
+/* PR tree-optimization/109410 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+#include "pr109410.c"
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index d2d2e084aa6a..7abbf195520b 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -1568,7 +1568,8 @@ build_and_add_sum (tree type, tree op1, tree op2, enum tree_code opcode)
if ((!op1def || gimple_nop_p (op1def))
&& (!op2def || gimple_nop_p (op2def)))
{
- gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
+ gsi = gsi_start_nondebug_after_labels_bb
+ (single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
if (!gsi_end_p (gsi)
&& is_gimple_call (gsi_stmt (gsi))
&& (gimple_call_flags (gsi_stmt (gsi)) & ECF_RETURNS_TWICE))
More information about the Gcc-cvs
mailing list