New Jacks Regressions: Constant Folding of Casts

Andrew Pinski pinskia@physics.uc.edu
Tue Jul 20 07:41:00 GMT 2004


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.

Thanks,
Andrew Pinski



More information about the Java mailing list