This is the mail archive of the
mailing list for the GCC project.
RFA (middle-end): Allow PUSH_ROUNDING to have a type.
- From: Joern Rennecke <amylaar at spamcop dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 05 Nov 2010 09:07:42 -0400
- Subject: RFA (middle-end): Allow PUSH_ROUNDING to have a type.
Most of the contexts where PUSH_ROUNDING is used are suitable for
an unsigned value, but there is one place in expr.cwhere only a signed
value will do without eliciting signed/unsigned comparison warnings.
Target ports that define PUSH_ROUNDING entirely with a macro get by
because the argument to PUSH_ROUNDING likewise varies in signedness, but
m32c is out of luck as it uses a function to define the macro.
Prohibiting the use of a function to define PUSH_ROUNDING wouldn't help
with our goal to move towards the use of target hooks, and requiring
C++ overloading doesn't really make sense either.
Therefore, I think it should be possible to define PUSH_ROUNDING in a way
that it returns one specific type. As the value is naturally unsigned, and
the majority of sites which use it require an unsigned definition, I think it
is best to adjust the one site that currently requires a signed definition.
bootstrapped on i686-pc-linux-gnu.
2010-11-05 Joern Rennecke <email@example.com>
* expr.c (emit_push_insn): Cast value of PUSH_ROUNDING before
comparing it to a signed value.
--- expr.c (revision 166313)
+++ expr.c (working copy)
@@ -3775,7 +3775,7 @@ emit_push_insn (rtx x, enum machine_mode
|| align >= BIGGEST_ALIGNMENT
|| (PUSH_ROUNDING (align / BITS_PER_UNIT)
== (align / BITS_PER_UNIT)))
- && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
+ && (HOST_WIDE_INT) PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
/* Push padding now if padding above and stack grows down,
or if padding below and stack grows up.