This is the mail archive of the gcc-patches@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: [PATCH] Fix ACATS failures in GCC 3.4


On Wed, 25 Feb 2004, Eric Botcazou wrote:
> 2004-02-25  Eric Botcazou  <ebotcazou@act-europe.fr>
>
> 	* 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
being performed.

[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
or ROTATEs].

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.

Roger
--


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