This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix ACATS failures in GCC 3.4
- From: Roger Sayle <roger at eyesopen dot com>
- To: Eric Botcazou <ebotcazou at act-europe dot fr>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 Feb 2004 06:57:06 -0700 (MST)
- Subject: Re: [PATCH] Fix ACATS failures in GCC 3.4
On Wed, 25 Feb 2004, Eric Botcazou wrote:
> 2004-02-25 Eric Botcazou <firstname.lastname@example.org>
> * fold-const.c (fold): Treat MAX_EXPR and MIN_EXPR like
> comparisons with regard to signedness.
This patch is OK for mainline and 3.4.
> I think the description of the patch is self-explanatory, but feel free to
> ask me to exercise my ASCII art skills to draw the trees if needed :-)
Without resorting to ASCII art (unless you really want to :-), could you
explain the sequence of events that lead to the failure. The patch itself
is harmless. My curiosity is that, unlike comparisons, the signedness of
the MIN_EXPR and MAX_EXPR operations can/should be determined by their
result type, i.e. TREE_UNSIGNED (TREE_TYPE (t)). Comparisons, on the
other hand, have Boolean-like result types, independent of the comparison
[I'm also a bit confused why RSHIFT is here, but apparently its been
this way since the current CVS was created. Shouldn't the type of an
RSHIFT be the same as the type of its first operand? The signedness of
its second operand is significant, but this is also the case for LSHIFT
Given this difference between MIN/MAX and comparisons, I'm wondering if
the real bug isn't a missing call to fold_convert somewhere, or the use
of an operand's type instead of the operator's type. Fixing this would
allow the additional optimizations available from STRIP_SIGN_NOPs that
aren't available with STRIP_NOPs, and as you point out gnat makes heavy
use of MIN/MAX.
My apologies for the breakage. Given that ACATS isn't yet tested by
default on many/most platforms, is there a simple C testcase that could
be added to the testsuite to prevent these failures in future? A test
would also help explain the failure.
Thanks for fixing this.