Created attachment 42726 [details] Preprocessed source code illustrating the bug. I got this when compiling an experimental version of GNU Emacs. I used GCC 7.2.1 20170915 (Red Hat 7.2.1-2) on x86-74 (Fedora 27). To reproduce, compile the attached program via: gcc -mmpx -fcheck-pointer-bounds -S v.i The output is: Unable to coalesce ssa_names 253 and 236 which are marked as MUST COALESCE. __bound_tmp.11_253(ab) and __bound_tmp.11_236(ab) v.i: In function ‘internal_lisp_condition_case.chkp’: v.i:143:1: internal compiler error: SSA corruption internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. Preprocessed source stored into /tmp/ccZ79fr1.out file, please attach this to y\ our bugreport. I will attach /tmp/ccZ79fr1.out.
Created attachment 42727 [details] Compiler output generated for crash on v.i
Confirmed. Seems to work on the GCC 6 branch and when optimizing.
Reduced testcase below. Started with r224643. /* PR tree-optimization/83177 */ /* { dg-do compile } */ /* { dg-options "-mmpx -fcheck-pointer-bounds" } */ extern int setjmp (void *); void *buf[64]; void bar (void); int foo (int *a) { int i, r = 0; for (i = 0; i < 64; ++i) { bar (); r += *--a; bar (); } for (i = 0; i < 64; ++i) { r += *a; setjmp (buf); bar (); } return r; }
Seems chkp_get_bounds_by_definition is called multiple times for the same stmt and we end up with: a_24(ab) = a_2(ab) + 18446744073709551612; __bound_tmp.1_39 = __bound_tmp.0_35(ab); __bound_tmp.0_40(ab) = __bound_tmp.1_39; __bound_tmp.1_37 = __bound_tmp.0_35(ab); __bound_tmp.0_38 = __bound_tmp.1_37; where the first pair of __bound_tmp assignments comes from the second invocation and the second pair from the first one. That is of course invalid, as it has overlapping ranges for (ab) __bound_tmp.0. Not sure what would be the best fix, maybe if we need bounds across some abnormal edge create a new SSA_NAME for that and assign it near the bottom of the bb that computes that bound. Anyway, not working on this.
Given likely MPX deprecation -> P4.
GCC 7.3 is being released, adjusting target milestone.
MPX is removed, won't fix then.