This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

crash in final.c during bootstrap on mips-sgi-irix6.2 [+patch]



hi -

The recent changes to final.c seem to break the mips platform.
I'm using a mips-sgi-irix6.2 platform, with egcs checked out from cvs
this afternoon (Sat., Mar 7).

When doing a `make bootstrap', gcc crashes while trying to compile frame.c.
After running it through the preprocessor, i get:

% ./cc1 -O2 -g frame.i
 __gthread_active_p __gthread_mutex_lock __gthread_mutex_trylock __gthread_mutex_unlock decode_uleb128 decode_sleb128 read_pointer read_1byte read_2byte read_4byte read_8byte fde_compare next_fde start_fde_sort fde_insert fde_split heapsort fde_merge end_fde_sort count_fdes add_fdes frame_init find_fde get_cie extract_cie_info execute_cfa_insn
../../../egcs/gcc/frame.c: In function `execute_cfa_insn':
../../../egcs/gcc/frame.c:663: internal error--unrecognizable insn:
(jump_insn 678 677 679 (addr_diff_vec:SI (label_ref:SI 677)
        [ 
            (label_ref:SI 683)
            (label_ref:SI 114)
            (label_ref:SI 136)
            (label_ref:SI 159)
            (label_ref:SI 190)
            (label_ref:SI 216)
            (label_ref:SI 289)
            (label_ref:SI 683)
            (label_ref:SI 683)
            (label_ref:SI 319)
            (label_ref:SI 463)
            (label_ref:SI 518)
            (label_ref:SI 375)
            (label_ref:SI 417)
            (label_ref:SI 441)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 656)
            (label_ref:SI 569)
            (label_ref:SI 634)
        ] 
        (const_int 0)
        (const_int 0) 0) -1 (nil)
    (expr_list:REG_BR_PRED (const_int 12)
        (nil)))
Abort (core dumped)


This crash goes away if the -O2 flag is not specified.

Here's the backtrace from the crash:

#0  0xfad185c in _kill ()
    at /xlv23/patches/2262/work/irix/lib/libc/libc_n32_M3/signal/kill.s:15
#1  0xfad1f28 in _raise ()
    at /xlv23/patches/2262/work/irix/lib/libc/libc_n32_M3/signal/raise.c:25
#2  0xfa38610 in abort ()
    at /xlv23/patches/2262/work/irix/lib/libc/libc_n32_M3/gen/abort.c:38
#3  0x1005ea34 in fatal_insn (
    message=0x10310c78 "internal error--unrecognizable insn:", insn=0x10406240)
    at ../../../egcs/gcc/toplev.c:1134
#4  0x1005ea9c in fatal_insn_not_found (insn=0x10406240)
    at ../../../egcs/gcc/toplev.c:1146
#5  0x1029e500 in insn_current_length (insn=0x10406240) at insn-attrtab.c:25
#6  0x1024c030 in shorten_branches (first=0x103f89a8)
    at ../../../egcs/gcc/final.c:1439
#7  0x10064e68 in rest_of_compilation (decl=0x103fa050)
    at ../../../egcs/gcc/toplev.c:3572
#8  0x10041240 in finish_function (nested=0) at ../../../egcs/gcc/c-decl.c:7116
#9  0x10023398 in yyparse () at c-parse.y:319
#10 0x10061f90 in compile_file (name=0x7fff3038 "frame.i")
    at ../../../egcs/gcc/toplev.c:2556
#11 0x10066b6c in main (argc=4, argv=0x7fff2d24, envp=0x7fff2d38)
    at ../../../egcs/gcc/toplev.c:4361


This is around the site in final.c of one of the recent changes.

That change, around line 1302, changed what was:

         if (! (varying_length[uid]))
            {
	      insn_current_address += insn_lengths[uid];
	      continue;
	    }
	  if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
	    {
               ...
	    }
	  else
	    {
	      new_length = insn_current_length (insn);
	      insn_current_address += new_length;
	    }

to

	  if (optimize && GET_CODE (insn) == JUMP_INSN
	      && GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
	    {
#ifdef CASE_VECTOR_SHORTEN_MODE
              ...
	      continue;
#endif /* CASE_VECTOR_SHORTEN_MODE */
	    }
	  else if (! (varying_length[uid]))
	    {
	      insn_current_address += insn_lengths[uid];
	      continue;
	    }
	  if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
	    {
               ...
	    }
	  else
	    {
	      new_length = insn_current_length (insn);//<- crash from this call
	      insn_current_address += new_length;
	    }

I checked that for this case, UID is 678, and varying_length[uid] is 0.
Thus, before the change, the flow went down the
	  if (! (varying_length[uid]))
path and hit the continue.

I tried getting rid of the `else' which was added in front of that test:

1998-03-07  scott snyder  <snyder@d0sgif.fnal.gov>

	* final.c (shorten_branches): Remove `else' after block
	implementing CASE_VECTOR_SHORTEN_MODE.

--- final.c     1998/03/06 14:44:24     1.23
+++ final.c     1998/03/08 00:22:01
@@ -1399,7 +1399,7 @@
              continue;
 #endif /* CASE_VECTOR_SHORTEN_MODE */
            }
-         else if (! (varying_length[uid]))
+         if (! (varying_length[uid]))
            {
              insn_current_address += insn_lengths[uid];
              continue;

With this change, the compiler completes the bootstrap at least...

thanks,
sss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]