https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126197

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-07-10
   Target Milestone|---                         |16.2
           Keywords|                            |ice-on-valid-code
                 CC|                            |amacleod at redhat dot com,
                   |                            |pinskia at gcc dot gnu.org

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Fixing up noreturn call f7 ();
Which splits the bb 5 from:
```
  <bb 5> [local count: 829143434]:
  fp10_3 ();
  if (c7_9(D) != 0)
    goto <bb 6>; [0.00%]
  else
    goto <bb 7>; [100.00%]
```

into:
```
  <bb 5> [local count: 829143434]:
  f7 ();

  <bb 9> [local count: 829143434]:
  if (c7_9(D) != 0)
    goto <bb 6>; [0.00%]
  else
    goto <bb 7>; [100.00%]
```

So there is no edge from bb 5 to bb 6 anymore but rather there is one from bb9
to bb 6.

Basically folder.m_unreachable records bb before this kind of fixup happens but
is not updated otherwise.
Anyways I think the fix is skip when no edge is found that is:
```
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
index 49eeedb8266..81fdea25a5d 100644
--- a/gcc/tree-vrp.cc
+++ b/gcc/tree-vrp.cc
@@ -328,6 +328,8 @@ remove_unreachable::remove_and_update_globals ()
       if (!src || !dest)
        continue;
       edge e = find_edge (src, dest);
+      if (!e)
+       continue;
       gimple *s = gimple_outgoing_range_stmt_p (e->src);
       gcc_checking_assert (gimple_code (s) == GIMPLE_COND);

```

because the new bb that is after the noreturn function is not reachable anyways
(after cfgcleanup happens) and will be removed.

Reply via email to