This is the mail archive of the gcc@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: New Jacks Regressions: Constant Folding of Casts


Andrew Pinski wrote:

> On Jul 20, 2004, at 12:30 AM, Ranjit Mathew wrote:
> 
> 
>>Hi,
>>
>>  In the last 24 hours, the following:
>>
>>    case ((int )Float.NaN == 0 ? 1 : 0): break;
>>
>>now gives an error saying "Constant expression required".
>>This causes 4 new Jacks failures. (Note that casting NaN
>>to an int should give the value 0.)
>>
>>I note that something like "0 == 0 ? 1 : 0" does not
>>give this error.
>>
>>I am not able to quickly tell what could be causing
>>this failure.
>>
>>Any insights?
> 
> 
> Maybe this change has something to do with it:
> 2004-07-19  Roger Sayle  <roger@eyesopen.com>
> 
>          * fold-const.c (tree_expr_nonzero_p): Add function prototype.
>          (fold) <EQ_EXPR>: Move tree_expr_nonzero_p optimization from
>          fold_relational_const to here, i.e. "(x | 5) == 0" -> false.
>          (fold) (UNEQ_EXPR>: Add optimizations for unordered comparisons
>          of the form "x op x" where op is UNLE, UNGE, UNEQ or LTGT.
>          (fold_relational_const): Tidy up handling of floating point
>          comparisons by calling real_compare.  Remove tree_expr_nonzero_p
>          transformation; fold_relational_const assumes constant operands.
> 
> Since that is the only change fold not to fold something.

Yes, that's what I suspected at first, but it doesn't seem
like that - I backed out that patch, rebuilt GCC and still
see the same failure.

Also:

  1. GCJ still correctly converts "(int)Float.NaN" to "0".

  2. "case (0==0 ? 1 : 2)" does not give the error.

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT gmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/


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