__builtin_constant_p broken

Jeffrey A Law law@cygnus.com
Wed Sep 30 19:48:00 GMT 1998


  In message < vyzg1daui6d.fsf@issan.informatik.uni-dortmund.de >you write:
  > __builtin_constant_p is supposed to expand to true only for arguments that
  > are compile-time constants.
  > 
  > 
  > 1998-09-29  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
  > 
  > 	* expr.c (expand_builtin, case BUILT_IN_CONSTANT_P): Return true
  > 	only for compile-time constants.
  > 	* cse.c (fold_rtx): Check that the argument of CONSTANT_P_RTX is a
  > 	compile-time constant.
  > 
  > --- egcs-2.92/gcc/cse.c.~1~	Tue Sep  8 14:20:28 1998
  > +++ egcs-2.92/gcc/cse.c	Tue Sep 29 22:10:01 1998
  > @@ -5749,7 +5749,12 @@
  >      case 'x':
  >        /* Always eliminate CONSTANT_P_RTX at this stage. */
  >        if (code == CONSTANT_P_RTX)
  > -	return (const_arg0 ? const1_rtx : const0_rtx);
  > +	return ((const_arg0
  > +		 && (GET_CODE (const_arg0) == CONST_INT
  > +		     || GET_CODE (const_arg0) == CONST_DOUBLE
  > +		     || (GET_CODE (const_arg0) == SYMBOL_REF
  > +			 && CONSTANT_POOL_ADDRESS_P (const_arg0))))
  > +		? const1_rtx : const0_rtx);
  >        break;
Shouldn't the check just be CONSTANT_P?   What specifically is appearing in
const_arg0 which isn't a compile-time constant?

The expr.c change looks fine.

jeff



More information about the Gcc-patches mailing list