Browse Source

gcc: Fix `registered' attribute on GCC 4.7.

* gcc-plugin/src/starpu.c (handle_heap_allocated_attribute)[stmt_list_stack]:
  Get the next-to-last element in STMT_LIST_STACK, not the last one.
Ludovic Courtès 13 years ago
parent
commit
9a867e4c88
1 changed files with 7 additions and 1 deletions
  1. 7 1
      gcc-plugin/src/starpu.c

+ 7 - 1
gcc-plugin/src/starpu.c

@@ -2049,7 +2049,13 @@ handle_heap_allocated_attribute (tree *node, tree name, tree args,
 	  tree parent, try_finally, registration;
 
 #ifdef stmt_list_stack
-	  parent = VEC_last (tree, stmt_list_stack);
+# ifdef VEC_index /* 4.7 */
+	  gcc_assert (VEC_length (tree, stmt_list_stack) > 1);
+	  parent = VEC_index (tree, stmt_list_stack,
+			      VEC_length (tree, stmt_list_stack) - 2);
+# else
+#  error not ported to 4.8!
+# endif
 #else  /* 4.6 and before */
 	  parent = TREE_CHAIN (cur_stmt_list);
 #endif