This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Integer overflow caused by SH INITIALIZE_TRAMPOLINE
- To: gcc-patches at gcc dot gnu dot org
- Subject: Integer overflow caused by SH INITIALIZE_TRAMPOLINE
- From: Andrew Haley <aph at cambridge dot redhat dot com>
- Date: Thu, 19 Jul 2001 15:30:27 +0100 (BST)
Now this is a weird one. On a michine with a 64-bit HOST_WIDE_INT,
compiling a trampoline on an SH fails with a constraint violation. It
turns out that this is because the compiler decides it can't fit a
32-bit integer in a SImode operand.
The patch below works, but it wouldn't work on a host with 64-bit
ints. There must be a better way to do this?
Andrew.
2001-07-19 Andrew Haley <aph@cambridge.redhat.com>
* config/sh/sh.h (INITIALIZE_TRAMPOLINE): Make GEN_INT operands
signed to prevent overflow.
Index: sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.110
diff -c -2 -p -u -r1.110 sh.h
cvs server: conflicting specifications of output style
--- sh.h 2001/07/09 06:10:06 1.110
+++ sh.h 2001/07/19 14:21:28
@@ -1241,5 +1241,6 @@ extern int current_function_anonymous_ar
{ \
emit_move_insn (gen_rtx_MEM (SImode, (TRAMP)), \
- GEN_INT (TARGET_LITTLE_ENDIAN ? 0xd301d202 : 0xd202d301));\
+ GEN_INT (TARGET_LITTLE_ENDIAN ?
+ (int)0xd301d202 : (int)0xd202d301));\
emit_move_insn (gen_rtx_MEM (SImode, plus_constant ((TRAMP), 4)), \
GEN_INT (TARGET_LITTLE_ENDIAN ? 0x0009422b : 0x422b0009));\