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]

Re: Reorder some tree codes


[ Trying to get IRIX to bootstrap after the holiday break... ]

Nathan Sidwell <nathan@codesourcery.com> writes:
> Mark Mitchell wrote:
>> The majority of the uses are actually in config/*/*.c, which surprised
>> me as well.  Some of those operate on INTVAL, so I think that it
>> probably is incorrect to use anything except HOST_WIDE_INT, sad though
>> that is.
>
> This patch reverts us to what was before

Not quite ;)

> 2004-12-22  Nathan Sidwell  <nathan@codesourcery.com>
>
> 	* system.h (IN_RANGE): Restore HOST_WIDE_INT cast.
> 	* tree.h (IS_EXPR_CODE_CLASS): Do not use IN_RANGE.
>
[...]
> Index: tree.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree.h,v
> retrieving revision 1.670
> diff -c -3 -p -r1.670 tree.h
> *** tree.h	22 Dec 2004 18:51:19 -0000	1.670
> --- tree.h	22 Dec 2004 22:01:42 -0000
> *************** extern const enum tree_code_class tree_c
> *** 147,153 ****
>      expression.  */
>   
>   #define IS_EXPR_CODE_CLASS(CLASS)\
> ! 	(IN_RANGE (CLASS, tcc_reference, tcc_expression))
>   
>   /* Returns nonzero iff NODE is an expression of some kind.  */
>   
> --- 147,153 ----
>      expression.  */
>   
>   #define IS_EXPR_CODE_CLASS(CLASS)\
> ! 	(((CLASS) - tcc_reference) <= (tcc_expression - tcc_reference))
>   
>   /* Returns nonzero iff NODE is an expression of some kind.  */
>   

The check used to be:

#define IS_EXPR_CODE_CLASS(CLASS)\
	(((CLASS) >= tcc_reference) && ((CLASS) <= tcc_expression))

and your new form assumes that the underlying type of enum tree_code_class
is unsigned.  That isn't true when bootstrapping on IRIX with the MIPSpro
compiler and so we blow up as soon as we try to compile something with
the stage1 compiler.

I guess the choices are to add unsigned casts to your new test or to go
back to the original.  The new form seems overly cute to me, especially
since GCC knows how to do that transformation itself, so I went for the
second option here.

The patch gets me past the initial failure.  OK if bootstrap succeeds?

Richard


	* tree.h (IS_EXPR_CODE_CLASS): Use a straight-forward range check.

Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.675
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.675 tree.h
*** tree.h	24 Dec 2004 05:23:08 -0000	1.675
--- tree.h	6 Jan 2005 21:09:38 -0000
*************** #define IS_TYPE_OR_DECL_P(CODE)\
*** 147,153 ****
     expression.  */
  
  #define IS_EXPR_CODE_CLASS(CLASS)\
! 	(((CLASS) - tcc_reference) <= (tcc_expression - tcc_reference))
  
  /* Returns nonzero iff NODE is an expression of some kind.  */
  
--- 147,153 ----
     expression.  */
  
  #define IS_EXPR_CODE_CLASS(CLASS)\
! 	((CLASS) >= tcc_reference && (CLASS) <= tcc_expression)
  
  /* Returns nonzero iff NODE is an expression of some kind.  */
  


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