This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch committed: Add cast to SUBREG_PROMOTED_UNSIGNED_P
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 19 Jun 2009 08:53:17 -0700
- Subject: Patch committed: Add cast to SUBREG_PROMOTED_UNSIGNED_P
The macro SUBREG_PROMOTED_UNSIGNED_P looks like this:
#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
((RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
? -1 : (RTX)->unchanging)
The unchanging field has type unsigned int : 1. In C the unchanging
field gets promoted to int, and the type of the conditional expression
is int. In C++ the unchanging field is unsigned int, and the type of
the conditional expression is unsigned int. In C++ this then causes
trouble with code like
if (SUBREG_PROMOTED_UNSIGNED_P (subreg) > 0)
in combine.c.
This patch adds a cast to int, which I think is clearer in any case.
Bootstrapped and tested on x86_64-unknown-linux-gnu. Committed.
Ian
2009-06-19 Ian Lance Taylor <iant@google.com>
* rtl.h (SUBREG_PROMOTED_UNSIGNED_P): Add cast to int.
Index: rtl.h
===================================================================
--- rtl.h (revision 148683)
+++ rtl.h (working copy)
@@ -1120,7 +1120,7 @@ do { \
} while (0)
#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
((RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
- ? -1 : (RTX)->unchanging)
+ ? -1 : (int) (RTX)->unchanging)
/* Access various components of an ASM_OPERANDS rtx. */