changeset 507:39dbe48d3fe2

Got rid of improper static array compile time index check. It had caused tango.core.Variant to fail to compile.
author Christian Kamm <kamm incasoftware de>
date Wed, 13 Aug 2008 22:31:46 +0200
parents a6c105aa00d5
children af9bdd69a7ec
files gen/arrays.cpp
diffstat 1 files changed, 2 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/gen/arrays.cpp	Wed Aug 13 22:14:43 2008 +0200
+++ b/gen/arrays.cpp	Wed Aug 13 22:31:46 2008 +0200
@@ -1035,23 +1035,8 @@
     Type* arrty = arr->getType()->toBasetype();
     assert((arrty->ty == Tsarray || arrty->ty == Tarray) && "Can only array bounds check for static or dynamic arrays");
 
-    // static arrays can get static checks for static indices
-
-    if(arr->getType()->ty == Tsarray)
-    {
-        TypeSArray* tsa = (TypeSArray*)arrty;
-        size_t tdim = tsa->dim->toInteger();
-
-        if(llvm::ConstantInt* cindex = llvm::dyn_cast<llvm::ConstantInt>(index->getRVal()))
-            if(cindex->uge(tdim + (isslice ? 1 : 0))) {
-                size_t cindexval = cindex->getValue().getZExtValue();
-                if(!isslice)
-                    error(loc, "index %u is larger or equal array size %u", cindexval, tdim);
-                else
-                    error(loc, "slice upper bound %u is larger than array size %u", cindexval, tdim);
-                return;
-            }
-    }
+    // static arrays could get static checks for static indices
+    // but shouldn't since it might be generic code that's never executed
 
     // runtime check