isl_aff_alloc: check that all divs are known
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 20 May 2011 09:23:49 +0000 (11:23 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 20 May 2011 13:10:00 +0000 (15:10 +0200)
isl_aff.c

index cc2dc77..e02de69 100644 (file)
--- a/isl_aff.c
+++ b/isl_aff.c
@@ -45,9 +45,16 @@ __isl_give isl_aff *isl_aff_alloc(__isl_take isl_local_space *ls)
                return NULL;
 
        ctx = isl_local_space_get_ctx(ls);
+       if (!isl_local_space_divs_known(ls))
+               isl_die(ctx, isl_error_invalid, "local space has unknown divs",
+                       goto error);
+
        total = isl_local_space_dim(ls, isl_dim_all);
        v = isl_vec_alloc(ctx, 1 + 1 + total);
        return isl_aff_alloc_vec(ls, v);
+error:
+       isl_local_space_free(ls);
+       return NULL;
 }
 
 __isl_give isl_aff *isl_aff_zero(__isl_take isl_local_space *ls)