]> granicus.if.org Git - clang/commitdiff
Remove broken assert from CodeGen. Better check is done in Sema.
authorSeo Sanghyeon <sanxiyn@gmail.com>
Wed, 26 Dec 2007 05:21:37 +0000 (05:21 +0000)
committerSeo Sanghyeon <sanxiyn@gmail.com>
Wed, 26 Dec 2007 05:21:37 +0000 (05:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45358 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGExprScalar.cpp
test/CodeGen/pointer-arithmetic.c

index f20c43f52285872dbca65a5be2603a3b147a2fad..81a0cedf4e98963256b7230acaf1799f12462191 100644 (file)
@@ -756,10 +756,7 @@ Value *ScalarExprEmitter::VisitBinSub(const BinaryOperator *E) {
   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;
   
index 6c644c6e06f8520f13396b488aaaf97e0f17d92f..6b4de91112855ef8e3f513a3e3a9d608fcea7bce 100644 (file)
@@ -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; }