This is the mail archive of the gcc-patches@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]

Reg-stack fix (gcc.c-torture/compile/991229-2.c)



Hi
The crash in gcc.c-torture/compile/991229-2.c testcase was caused by reg-stack
problem.
The stmt.c in non-optimizing compilation generates USEs that may force
variable live longer than necesary:

  /* If doing stupid register allocation, make sure life of any
     register variable starts here, at the start of its scope.  */

  if (obey_regdecls)
    use_variable (DECL_RTL (decl));

Reg-stack didn't liked uses making register suddenly live and thus aborted.

Now my predicates patch passes whole testsuite w/o problem, but the reload
problem is still present, only not very common.

Wed Jan  5 14:37:42 MET 2000  Jan Hubicka  <hubicka@freesoft.cz>
	* reg-stack.c (subst_stack_regs_pat): Handle correctly USEs of
	dead registers.

Index: egcs/gcc/reg-stack.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reg-stack.c,v
retrieving revision 1.50
diff -c -3 -p -r1.50 reg-stack.c
*** reg-stack.c	2000/01/04 16:29:40	1.50
--- reg-stack.c	2000/01/05 13:35:18
*************** subst_stack_regs_pat (insn, regstack, pa
*** 1383,1394 ****
        if (STACK_REG_P (*src) 
            && find_regno_note (insn, REG_DEAD, REGNO (*src)))
          {
! 	   emit_pop_insn (insn, regstack, *src, EMIT_AFTER);
  	   return;
          }
-       /* ??? Uninitialized USE should not happen.  */
        else if (get_hard_regnum (regstack, *src) == -1)
! 	abort();
        break;
  
      case CLOBBER:
--- 1383,1406 ----
        if (STACK_REG_P (*src) 
            && find_regno_note (insn, REG_DEAD, REGNO (*src)))
          {
! 	   /* In stupid allocation the USE might be used to extend lifetime
! 	      of variable to given scope.  This may end up as USE of dead
! 	      register.  */
! 	   if (optimize || get_hard_regnum (regstack, *src) != -1)
! 	     emit_pop_insn (insn, regstack, *src, EMIT_AFTER);
  	   return;
          }
        else if (get_hard_regnum (regstack, *src) == -1)
! 	{
! 	   if (optimize)
! 	     abort();
! 	   if (GET_CODE (PATTERN (insn)) != USE)
! 	     abort();
! 	   PATTERN (insn) = gen_rtx_SET (GET_MODE (*src), *src,
! 					 CONST0_RTX (GET_MODE (*src)));
! 	   subst_stack_regs_pat (insn, regstack, PATTERN (insn));
! 	   return;
! 	}
        break;
  
      case CLOBBER:

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