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

Manjunath S Matti <mmatti at linux dot vnet.ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmatti at linux dot 
vnet.ibm.com

--- Comment #11 from Manjunath S Matti <mmatti at linux dot vnet.ibm.com> ---
This also breaks bootstrap on both powerpc64le-unknown-linux-gnu and
powerpc64-unknown-linux-gnu.  Trunk r17-3337-ge7b77e39552d, configured with

  ../gcc/configure --prefix=... --enable-languages=c,c++,fortran,objc,obj-c++ \
      --with-cpu=power10 --enable-secureplt

Both endians die in stage 3 on the same translation unit:

  during GIMPLE pass: thread
  ../../gcc/libcpp/lex.cc: In function 'void _cpp_clean_line(cpp_reader*)':
  ../../gcc/libcpp/lex.cc:970:1: internal compiler error: Segmentation fault
    970 | _cpp_clean_line (cpp_reader *pfile)
        | ^~~~~~~~~~~~~~~
  0x12362e70 path_range_query::ssa_range_in_phi(vrange&, gphi*)
          ../../gcc/gcc/gimple-range-path.cc:262
  0x1236323f path_range_query::range_defined_in_block(vrange&, tree_node*,
basic_block_def*)
          ../../gcc/gcc/gimple-range-path.cc:303
  0x12362753 path_range_query::internal_range_of_expr(vrange&, tree_node*,
gimple*)
          ../../gcc/gcc/gimple-range-path.cc:160
  [...]
  make[3]: *** [Makefile:227: lex.o] Error 1


To unblock our ppc64 toolchain builds we are carrying the conservative guard
below.  Posting it for information rather than as a proposed fix - if the
answer
is that these nested queries should go to the root ranger instead, that is
clearly the better fix.

--- a/gcc/gimple-range-path.cc
+++ b/gcc/gimple-range-path.cc
@@ -256,6 +256,14 @@ path_range_query::ssa_range_in_phi (vrange &r, gphi *phi)
   basic_block bb = gimple_bb (phi);
   basic_block prev = prev_bb ();
   edge e_in = find_edge (prev, bb);
+  // The fold machinery can invoke this query (via get_range_query) for a
+  // PHI which is not at the current position in the path, in which case
+  // there is no path edge to select an argument from.
+  if (!e_in)
+    {
+      r.set_varying (TREE_TYPE (name));
+      return;
+    }
   // The incoming edge the path supplies is never abnormal, so the
   // argument on it is a valid value for the PHI result even when the
   // result occurs in an abnormal PHI.

With it, the stage 3 libcpp/lex.cc that used to ICE compiles, and both reduced
testcases in comment #2 and comment #9 compile clean.  gcc.dg/tree-ssa shows no
change (the only non-execution failure, update-threading.c "Invalid sum", is
already there without the patch).  Full bootstraps on both endians are running
now; I will report back.

Reply via email to