This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New Jacks Regressions: Constant Folding of Casts
- From: Roger Sayle <roger at eyesopen dot com>
- To: Ranjit Mathew <rmathew at gmail dot com>
- Cc: java at gcc dot gnu dot org, <gcc at gcc dot gnu dot org>
- Date: Tue, 20 Jul 2004 07:16:52 -0600 (MDT)
- Subject: Re: New Jacks Regressions: Constant Folding of Casts
On Tue, 20 Jul 2004, Ranjit Mathew wrote:
> >>
> >> In the last 24 hours, the following:
> >>
> >> case ((int )Float.NaN == 0 ? 1 : 0): break;
> >>
> >>now gives an error saying "Constant expression required".
> >>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.
> >
>
> 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.
That's a relief :). It might be related to Steve Bosschers improvements
to switch statement handling. The middle-end now does far less processing
of switch/case statements, and expects the front-end to issue diagnostics,
remove duplicate case nodes, etc... Perhaps the java front-end has been
relying on the middle-end to call "fold" on case nodes for it. Could you
check that "((int)Float.Nan == 0 ? 1 : 0" is being folded as its being
constructed. Does "case (int)Float.Nan:" work?
Roger
--