This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, gfortran] Use fold_build (almost) everywhere
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 22 Mar 2008 22:34:46 +0100
- Subject: [patch, gfortran] Use fold_build (almost) everywhere
This patch changes the build{1,2,3}_v macros to use fold_build. This
lead to a few failures in the OMP testsuite which are fixed by the two
changes to trans-omp.c (which expand the macro pre-patch). Apparently,
folding OMP trees is not a good idea. A new version of OMP is scheduled
for inclusion, so maybe life will get better then.
Built and tested on i386-darwin. Ok?
Cheers,
- Tobi
2008-03-22 Tobias Schlüter <tobi@gcc.gnu.org>
* trans.h: Use fold_build in build1_v, build2_v and build3_v
macros.
* trans-openmp.c (gfc_trans_omp_critical, gfc_trans_omp_single):
Don't use build2_v macro.
diff -r f275a3364621 gcc/fortran/trans-openmp.c
--- a/gcc/fortran/trans-openmp.c Sat Mar 22 00:17:15 2008 +0000
+++ b/gcc/fortran/trans-openmp.c Sat Mar 22 22:27:48 2008 +0100
@@ -888,7 +888,7 @@ gfc_trans_omp_critical (gfc_code *code)
if (code->ext.omp_name != NULL)
name = get_identifier (code->ext.omp_name);
stmt = gfc_trans_code (code->block->next);
- return build2_v (OMP_CRITICAL, stmt, name);
+ return build2 (OMP_CRITICAL, void_type_node, stmt, name);
}
static tree
@@ -1216,7 +1216,7 @@ gfc_trans_omp_single (gfc_code *code, gf
{
tree omp_clauses = gfc_trans_omp_clauses (NULL, clauses, code->loc);
tree stmt = gfc_trans_omp_code (code->block->next, true);
- stmt = build2_v (OMP_SINGLE, stmt, omp_clauses);
+ stmt = build2 (OMP_SINGLE, void_type_node, stmt, omp_clauses);
return stmt;
}
diff -r f275a3364621 gcc/fortran/trans.h
--- a/gcc/fortran/trans.h Sat Mar 22 00:17:15 2008 +0000
+++ b/gcc/fortran/trans.h Sat Mar 22 22:27:48 2008 +0100
@@ -637,11 +637,11 @@ struct lang_decl GTY(())
(TYPE_LANG_SPECIFIC(node)->dataptr_type)
/* Build an expression with void type. */
-#define build1_v(code, arg) build1(code, void_type_node, arg)
-#define build2_v(code, arg1, arg2) build2(code, void_type_node, \
- arg1, arg2)
-#define build3_v(code, arg1, arg2, arg3) build3(code, void_type_node, \
- arg1, arg2, arg3)
+#define build1_v(code, arg) fold_build1(code, void_type_node, arg)
+#define build2_v(code, arg1, arg2) fold_build2(code, void_type_node, \
+ arg1, arg2)
+#define build3_v(code, arg1, arg2, arg3) fold_build3(code, void_type_node, \
+ arg1, arg2, arg3)
#define build4_v(code, arg1, arg2, arg3, arg4) build4(code, void_type_node, \
arg1, arg2, arg3, arg4)