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]
Other format: [Raw text]

[3.1] Re: ICE in do_SUBST when compiling


> Hi,
> 
> We have an ICE in do_SUBST on x86_64, even with the current CVS of gcc 3.1.
> 
> If compiled with gcc -O2 foo.i we get:
> /suse/meissner/foo.i: In function `g':
> /suse/meissner/foo.i:5: Internal compiler error in do_SUBST, at combine.c:439
> 
> I have attached foo.i since it is very short.
> 
> Ciao, Marcus

> unsigned short
> g (unsigned short x)
> {
>   return (x < 32767) ? x : 32767;
> }
Hi,
this patch is backported form 3.2.  I've bootstrapped it, but I am not sure
whether it can go to 3.1.  It is fairly obvious, but I am not aware of other
target where the bug reproduce.  Mark?

I've had approval from Richard for it, but due to changes in plan for diploma I
missed my chance to put it on the branch.

Honza

Tue Apr 30 19:30:49 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* loop.c (canonicalize_condition): Truncate to proper mode.
Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.389.2.5
diff -c -3 -p -r1.389.2.5 loop.c
*** loop.c	10 Apr 2002 06:52:19 -0000	1.389.2.5
--- loop.c	30 Apr 2002 17:29:35 -0000
*************** canonicalize_condition (insn, cond, reve
*** 9260,9266 ****
  	{
  	case LE:
  	  if ((unsigned HOST_WIDE_INT) const_val != max_val >> 1)
! 	    code = LT, op1 = GEN_INT (const_val + 1);
  	  break;
  
  	/* When cross-compiling, const_val might be sign-extended from
--- 9260,9266 ----
  	{
  	case LE:
  	  if ((unsigned HOST_WIDE_INT) const_val != max_val >> 1)
! 	    code = LT, op1 = GEN_INT (trunc_int_for_mode (const_val + 1, GET_MODE (op0)));
  	  break;
  
  	/* When cross-compiling, const_val might be sign-extended from
*************** canonicalize_condition (insn, cond, reve
*** 9269,9285 ****
  	  if ((HOST_WIDE_INT) (const_val & max_val)
  	      != (((HOST_WIDE_INT) 1
  		   << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1))))
! 	    code = GT, op1 = GEN_INT (const_val - 1);
  	  break;
  
  	case LEU:
  	  if (uconst_val < max_val)
! 	    code = LTU, op1 = GEN_INT (uconst_val + 1);
  	  break;
  
  	case GEU:
  	  if (uconst_val != 0)
! 	    code = GTU, op1 = GEN_INT (uconst_val - 1);
  	  break;
  
  	default:
--- 9269,9285 ----
  	  if ((HOST_WIDE_INT) (const_val & max_val)
  	      != (((HOST_WIDE_INT) 1
  		   << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1))))
! 	    code = GT, op1 = GEN_INT (trunc_int_for_mode (const_val - 1, GET_MODE (op0)));
  	  break;
  
  	case LEU:
  	  if (uconst_val < max_val)
! 	    code = LTU, op1 = GEN_INT (trunc_int_for_mode (uconst_val + 1, GET_MODE (op0)));
  	  break;
  
  	case GEU:
  	  if (uconst_val != 0)
! 	    code = GTU, op1 = GEN_INT (trunc_int_for_mode (uconst_val - 1, GET_MODE (op0)));
  	  break;
  
  	default:


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