[cfe-commits] r45358 - in /cfe/trunk: CodeGen/CGExprScalar.cpp test/CodeGen/pointer-arithmetic.c
Seo Sanghyeon
sanxiyn at gmail.com
Tue Dec 25 21:21:38 PST 2007
Author: sanxiyn
Date: Tue Dec 25 23:21:37 2007
New Revision: 45358
URL: http://llvm.org/viewvc/llvm-project?rev=45358&view=rev
Log:
Remove broken assert from CodeGen. Better check is done in Sema.
Modified:
cfe/trunk/CodeGen/CGExprScalar.cpp
cfe/trunk/test/CodeGen/pointer-arithmetic.c
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=45358&r1=45357&r2=45358&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Tue Dec 25 23:21:37 2007
@@ -756,10 +756,7 @@
Value *RHS = Visit(E->getRHS());
const QualType LHSType = E->getLHS()->getType().getCanonicalType();
- const QualType RHSType = E->getRHS()->getType().getCanonicalType();
- assert(LHSType == RHSType && "Can't subtract different pointer types");
-
- QualType LHSElementType = cast<PointerType>(LHSType)->getPointeeType();
+ const QualType LHSElementType = cast<PointerType>(LHSType)->getPointeeType();
uint64_t ElementSize = CGF.getContext().getTypeSize(LHSElementType,
SourceLocation()) / 8;
Modified: cfe/trunk/test/CodeGen/pointer-arithmetic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pointer-arithmetic.c?rev=45358&r1=45357&r2=45358&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/pointer-arithmetic.c (original)
+++ cfe/trunk/test/CodeGen/pointer-arithmetic.c Tue Dec 25 23:21:37 2007
@@ -3,3 +3,5 @@
typedef int Int;
int test1(int *a, Int *b) { return a - b; }
+
+int test2(const char *a, char *b) { return b - a; }
More information about the cfe-commits
mailing list