===================================================================
@@ -383,6 +383,10 @@
isl_ast_expr *for_iterator = isl_ast_node_for_get_iterator (node_for);
isl_id *id = isl_ast_expr_get_id (for_iterator);
+ std::map<isl_id *, tree>::iterator res;
+ res = ip.find (id);
+ if (ip.count (id))
+ isl_id_free (res->first);
ip[id] = iv;
isl_ast_expr_free (for_iterator);
return loop;
===================================================================
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fgraphite-identity -fgraphite-code-generator=isl" } */
+
+static int __attribute__((noinline))
+foo (int k, int n1, int n2, int n3)
+{
+ int j, res = 0;
+ for (j = 0; j < k; j++)
+ {
+ int i;
+ for (i = 0; i < n1; i++)
+ res += i;
+ for (i = 0; i < n2; i++)
+ res += i;
+ for (i = 0; i < n3; i++)
+ res += i;
+ }
+
+ return res;
+}
+
+extern void abort ();
+
+int
+main (void)
+{
+ int res = foo (4, 50, 50, 50);
+ if (res != 14700)
+ abort ();
+
+ return 0;
+}