fix for execute/991221-1.c -O1 failure

Jeffrey A Law law@cygnus.com
Fri Dec 31 16:38:00 GMT 1999


  In message < 199912240645.GAA16571@phal.cygnus.co.uk >you write:
  > Hmmm, I forgot to re-generate the patch after I fixed this to actually
  > use TYPE.
  > 
  > But I have a different problem here: the bootstrap fails when compiling
  > reload.  It encounters a pointer_type, and this has no min nor max value.
  > 
  > (gdb) call debug_tree(type)
  >  <pointer_type 0x4028c280
  >     type <integer_type 0x4001a300 short int
  >         permanent HI
  >         size <integer_cst 0x40019320 constant permanent 16>
  >         align 16 symtab 8 alias set 24 precision 16
  >         min <integer_cst 0x400194a0 constant permanent -32768>
  >         max <integer_cst 0x400194c0 constant permanent 32767>
  >         pointer_to_this <pointer_type 0x4028c280>>
  >    
  >     unsigned permanent SI
  >     size <integer_cst 0x40019560 type <integer_type 0x4001b580 unsigned int
  > > constant permanent 32>
  >     align 32 symtab 352 alias set 93>
  > 
  > Should I get the limits from somewhere else?  Or should pointers be
  > treated as having indeed no bounds?
Treating the pointer type as having no bounds is certainly a safe thing to
do.  Finding the range of a pointer type is somewhat complicated by the
signed vs unsigned issues.


Note instead of:

!   sgn0 = (upper0_p
! 	  ? (! arg0 || operand_equal_p (arg0, TYPE_MAX_VALUE (type), 1)
! 	     ? 1 : 0)
! 	  : (! arg0 || operand_equal_p (arg0, TYPE_MIN_VALUE (type), 1)
! 	     ? -1 : 0));


It might be better to write

   sgn0 = (! arg0 || operand_equal_p (arg0, TYPE_MAX_VALUE (type), 1)
           ? (upper0_p ? 1 : -1) : 0);

Similarly for the other instances of similar code.  

jeff



More information about the Gcc-patches mailing list