[Bug tree-optimization/79621] [7 Regression] ICE in operator[], at vec.h:732

law at redhat dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 21 05:57:00 GMT 2017


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

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
What a cool little bug.  AFAICT, the underlying issue has been latent since the
introduction of gimple-ssa-isolate-paths a few years back.

We have this PHI at the start of BB4:
e7_11 = PHI <e7_13(D)(3), e7_13(D)(5), e7_11(4), 0(6)>

Note the 0 associated with the edge 6->4, which gets used in bb4 like this:

_3 = b5.2_2 / e7_11;

Which of course triggers isolation of the path with a division by zero.

Also note there is a PHI arg for the edge 4->4.

With that background in mind...  Consider the sequencing of path isolation. 
First we duplicate bb4 so that we have a copy we can freely modify.  The
duplication (of course) includes duplicating the outgoing edges, including the
edge 4->4.  That potentially resizes the PHI.   *But* the loop in
gimple-ssa-isolate_paths.c isn't aware of that possibility and as a result may
use the old PHI the next iteration of the loop and nothing good happens
thereafter.


More information about the Gcc-bugs mailing list