diff dmd/cast.c @ 94:61615fa85940 trunk

[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca"). Added support for array .sort and .reverse properties. Fixed some bugs with pointer arithmetic. Disabled some DMD AST optimizations that was messing things up, destroying valuable information. Added a KDevelop project file, this is what I use for coding LLVMDC now :) Other minor stuff.
author lindquist
date Mon, 12 Nov 2007 06:32:46 +0100
parents 788401029ecf
children 5825d48b27d1
line wrap: on
line diff
--- a/dmd/cast.c	Thu Nov 08 19:21:05 2007 +0100
+++ b/dmd/cast.c	Mon Nov 12 06:32:46 2007 +0100
@@ -1116,7 +1116,7 @@
 	e2->type = t;
 	type = e1->type;
     }
-    else if (t2b->ty && t1b->isintegral())
+    else if (t2b->ty == Tpointer && t1b->isintegral())
     {   // Need to adjust operator by the stride
 	// Replace (int + ptr) with (ptr + (int * stride))
 	Type *t = Type::tptrdiff_t;
@@ -1127,11 +1127,13 @@
 	    e = e1->castTo(sc, t);
 	else
 	    e = e1;
+    #if !IN_LLVM
 	if (t2b->next->isbit())
 	    // BUG: should add runtime check for misaligned offsets
 	    e = new UshrExp(loc, e, new IntegerExp(0, 3, t));
 	else
 	    e = new MulExp(loc, e, new IntegerExp(0, stride, t));
+    #endif
 	e->type = t;
 	type = e2->type;
 	e1 = e2;