summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-28 12:04:54 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-28 12:04:54 +0000
commit5df674ea0861a65eecd855a93da4c64c226a4861 (patch)
treebb1f1cf3fc571083de0db917a2eeeb95c8c15cb4
parent596981c8fa329037fcb1297eaa219a36ad323e3e (diff)
downloadgcc-5df674ea0861a65eecd855a93da4c64c226a4861.tar.gz
gcc/
* vec.h (vec_heap_free): Add parentheses around free. gcc/fortran/ * trans-openmp.c (dovar_init): Define. Define VECs containing it. (gfc_trans_omp_do): Use a VEC to accumulate variables and their initializers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161486 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-openmp.c26
-rw-r--r--gcc/vec.h3
4 files changed, 29 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7b5976187e9..8a25bc7b7f9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * vec.h (vec_heap_free): Add parentheses around free.
+
2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
* system.h: Poison GCC_EXCEPT_H for front-end files.
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index fc8445c784d..6fbac64a2db 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2010-06-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * trans-openmp.c (dovar_init): Define. Define VECs containing it.
+ (gfc_trans_omp_do): Use a VEC to accumulate variables and their
+ initializers.
+
2010-06-28 Steven Bosscher <steven@gcc.gnu.org>
* Make-lang.in: Update dependencies.
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index a5d5ba133e7..7a7d33088d7 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -1150,6 +1150,14 @@ gfc_trans_omp_critical (gfc_code *code)
return build2 (OMP_CRITICAL, void_type_node, stmt, name);
}
+typedef struct dovar_init_d {
+ tree var;
+ tree init;
+} dovar_init;
+
+DEF_VEC_O(dovar_init);
+DEF_VEC_ALLOC_O(dovar_init,heap);
+
static tree
gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
gfc_omp_clauses *do_clauses, tree par_clauses)
@@ -1161,7 +1169,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
stmtblock_t body;
gfc_omp_clauses *clauses = code->ext.omp_clauses;
int i, collapse = clauses->collapse;
- tree dovar_init = NULL_TREE;
+ VEC(dovar_init,heap) *inits = NULL;
+ dovar_init *di;
+ unsigned ix;
if (collapse <= 0)
collapse = 1;
@@ -1276,7 +1286,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
/* Initialize DOVAR. */
tmp = fold_build2 (MULT_EXPR, type, count, step);
tmp = fold_build2 (PLUS_EXPR, type, from, tmp);
- dovar_init = tree_cons (dovar, tmp, dovar_init);
+ di = VEC_safe_push (dovar_init, heap, inits, NULL);
+ di->var = dovar;
+ di->init = tmp;
}
if (!dovar_found)
@@ -1345,13 +1357,9 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
gfc_start_block (&body);
- dovar_init = nreverse (dovar_init);
- while (dovar_init)
- {
- gfc_add_modify (&body, TREE_PURPOSE (dovar_init),
- TREE_VALUE (dovar_init));
- dovar_init = TREE_CHAIN (dovar_init);
- }
+ for (ix = 0; VEC_iterate (dovar_init, inits, ix, di); ix++)
+ gfc_add_modify (&body, di->var, di->init);
+ VEC_free (dovar_init, heap, inits);
/* Cycle statement is implemented with a goto. Exit statement must not be
present for this loop. */
diff --git a/gcc/vec.h b/gcc/vec.h
index c32bf8829e3..93a432df839 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -436,7 +436,8 @@ extern void dump_vec_loc_statistics (void);
#ifdef GATHER_STATISTICS
void vec_heap_free (void *);
#else
-#define vec_heap_free(V) free (V)
+/* Avoid problems with frontends that #define free(x). */
+#define vec_heap_free(V) (free) (V)
#endif
#if ENABLE_CHECKING