re PR bootstrap/49680 (IRIX 6.5 bootstrap broken: SEGV in __register_frame_info_bases)
authorHans-Peter Nilsson <hp@axis.com>
Sat, 9 Jul 2011 22:35:43 +0000 (22:35 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Sat, 9 Jul 2011 22:35:43 +0000 (22:35 +0000)
PR bootstrap/49680
* config/cris/cris.c (cris_asm_output_case_end): Robustify against
stray notes and debug insns by using prev_nonnote_nondebug_insn
instead of PREV_INSN.

From-SVN: r176110

gcc/ChangeLog
gcc/config/cris/cris.c

index 436e037cb3637d8bc29a47d6f5db9c1243ffe171..fba2db93a9e394b91fd74e2a335eeb317e7f557c 100644 (file)
@@ -1,3 +1,10 @@
+2011-07-10  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR bootstrap/49680
+       * config/cris/cris.c (cris_asm_output_case_end): Robustify against
+       stray notes and debug insns by using prev_nonnote_nondebug_insn
+       instead of PREV_INSN.
+
 2011-07-09  Richard Henderson  <rth@redhat.com>
 
        * defaults.h (DWARF2_ADDR_SIZE, DWARF_OFFSET_SIZE,
index 54a0f266cac4675a088e0a983869e85a06139c94..0c318268440ac038396378f1425ca8cf090d8768 100644 (file)
@@ -2275,12 +2275,22 @@ cris_legitimate_pic_operand (rtx x)
 void
 cris_asm_output_case_end (FILE *stream, int num, rtx table)
 {
+  /* Step back, over the label for the table, to the actual casejump and
+     assert that we find only what's expected.  */
+  rtx whole_jump_insn = prev_nonnote_nondebug_insn (table);
+  gcc_assert (whole_jump_insn != NULL_RTX && LABEL_P (whole_jump_insn));
+  whole_jump_insn = prev_nonnote_nondebug_insn (whole_jump_insn);
+  gcc_assert (whole_jump_insn != NULL_RTX
+             && (JUMP_P (whole_jump_insn)
+                 || (TARGET_V32 && INSN_P (whole_jump_insn)
+                     && GET_CODE (PATTERN (whole_jump_insn)) == SEQUENCE)));
+  /* Get the pattern of the casejump, so we can extract the default label.  */
+  whole_jump_insn = PATTERN (whole_jump_insn);
+
   if (TARGET_V32)
     {
-      rtx whole_jump_insn = PATTERN (PREV_INSN (PREV_INSN (table)));
-
       /* This can be a SEQUENCE, meaning the delay-slot of the jump is
-        filled.  */
+        filled.  We also output the offset word a little differently.  */
       rtx parallel_jump
        = (GET_CODE (whole_jump_insn) == SEQUENCE
           ? PATTERN (XVECEXP (whole_jump_insn, 0, 0)) : whole_jump_insn);
@@ -2298,11 +2308,7 @@ cris_asm_output_case_end (FILE *stream, int num, rtx table)
               "\t.word %LL%d-%LL%d%s\n",
               CODE_LABEL_NUMBER (XEXP
                                  (XEXP
-                                  (XEXP
-                                   (XVECEXP
-                                    (PATTERN
-                                     (PREV_INSN
-                                      (PREV_INSN (table))), 0, 0), 1),
+                                  (XEXP (XVECEXP (whole_jump_insn, 0, 0), 1), 
                                    2), 0)),
               num,
               (TARGET_PDEBUG ? "; default" : ""));