[llvm-commits] [llvm-gcc-4.0] r43293 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
Dale Johannesen
dalej at apple.com
Wed Oct 24 09:38:24 PDT 2007
Author: johannes
Date: Wed Oct 24 11:38:24 2007
New Revision: 43293
URL: http://llvm.org/viewvc/llvm-project?rev=43293&view=rev
Log:
Honor signedness of constant when converting
ptr+-constant to getelementptr.
gcc.c-torture/execute/20010329-1.c
Modified:
llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43293&r1=43292&r2=43293&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Wed Oct 24 11:38:24 2007
@@ -3351,8 +3351,8 @@
TREE_CODE(TREE_OPERAND(exp, 1)) == INTEGER_CST) {
int64_t Offset = getINTEGER_CSTVal(TREE_OPERAND(exp, 1));
- // If POINTER_SIZE is 32-bits, sign extend the offset.
- if (POINTER_SIZE == 32)
+ // If POINTER_SIZE is 32-bits and the offset is signed, sign extend the offset.
+ if (POINTER_SIZE == 32 && !TYPE_UNSIGNED(TREE_TYPE(TREE_OPERAND(exp, 1))))
Offset = (Offset << 32) >> 32;
// Figure out how large the element pointed to is.
More information about the llvm-commits
mailing list