PR bootstrap/95555 - powepc64 bootstrap failure due to -Wmaybe-uninitialized in reloa...
authorMartin Sebor <msebor@redhat.com>
Mon, 8 Jun 2020 15:06:48 +0000 (09:06 -0600)
committerMartin Sebor <msebor@redhat.com>
Mon, 8 Jun 2020 15:06:48 +0000 (09:06 -0600)
gcc/ChangeLog:

* postreload.c (reload_cse_simplify_operands): Clear first array element
before using it.  Assert a precondition.

gcc/postreload.c

index f625828502248f74f9fd88f6383e6e04b02a0cb8..c9e637500f17133c8b058174088192e33acad679 100644 (file)
@@ -592,6 +592,13 @@ reload_cse_simplify_operands (rtx_insn *insn, rtx testreg)
        }
     }
 
+  /* The loop below sets alternative_order[0] but -Wmaybe-uninitialized
+     can't know that.  Clear it here to avoid the warning.  */
+  alternative_order[0] = 0;
+  gcc_assert (!recog_data.n_alternatives
+             || (which_alternative >= 0
+                 && which_alternative < recog_data.n_alternatives));
+
   /* Record all alternatives which are better or equal to the currently
      matching one in the alternative_order array.  */
   for (i = j = 0; i < recog_data.n_alternatives; i++)