aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2009-05-15 08:52:41 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2009-05-15 08:52:41 +0200
commit602b85231dd432fdad1cdb814eec39d449a33d7f (patch)
treebb58acd84e5324e34712e80a80cc5d4bccdea56f
parent675a72d643ceab289bc4adc0484cd90c2812caf5 (diff)
downloadgcc-602b85231dd432fdad1cdb814eec39d449a33d7f.zip
gcc-602b85231dd432fdad1cdb814eec39d449a33d7f.tar.gz
gcc-602b85231dd432fdad1cdb814eec39d449a33d7f.tar.bz2
re PR fortran/39352 (gfortran.dg/vect/pr39318.f90 doesn't work on ia64)
2009-05-15 Tobias Burnus <burnus@net-b.de> PR fortran/39352 * f95-lang.c: Add gfc_maybe_initialize_eh. * gfortran.h: Add gfc_maybe_initialize_eh prototype. * Make-lang.in: Add new .h dendencies for f95-lang.c * openmp.c (resolve_omp_do): Call gfc_maybe_initialize_eh. * misc.c (gfc_free): Avoid #define trickery for free. From-SVN: r147559
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/Make-lang.in3
-rw-r--r--gcc/fortran/f95-lang.c24
-rw-r--r--gcc/fortran/gfortran.h3
-rw-r--r--gcc/fortran/misc.c13
-rw-r--r--gcc/fortran/openmp.c3
6 files changed, 44 insertions, 11 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 5b963a1..bc6dd0b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,12 @@
+2009-05-15 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/39352
+ * f95-lang.c: Add gfc_maybe_initialize_eh.
+ * gfortran.h: Add gfc_maybe_initialize_eh prototype.
+ * Make-lang.in: Add new .h dendencies for f95-lang.c
+ * openmp.c (resolve_omp_do): Call gfc_maybe_initialize_eh.
+ * misc.c (gfc_free): Avoid #define trickery for free.
+
2009-05-14 Steven G. Kargl <kargl@gcc.gnu.org>
* dump-parse-tree.c (show_code_node): Add ERRMSG to the dumping
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index ba81b93..5885a62 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -313,7 +313,8 @@ GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \
fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) fortran/cpp.h \
- $(BUILTINS_DEF) fortran/types.def
+ $(BUILTINS_DEF) fortran/types.def \
+ libfuncs.h expr.h except.h
fortran/scanner.o: toplev.h fortran/cpp.h
fortran/convert.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans.o: $(GFORTRAN_TRANS_DEPS) tree-iterator.h
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 1aab3bf..97a071d 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -43,6 +43,10 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-dump.h"
#include "cgraph.h"
+/* For gfc_maybe_initialize_eh. */
+#include "libfuncs.h"
+#include "expr.h"
+#include "except.h"
#include "gfortran.h"
#include "cpp.h"
@@ -165,6 +169,10 @@ static GTY(()) struct binding_level *free_binding_level;
It is indexed by a RID_... value. */
tree *ridpointers = NULL;
+/* True means we've initialized exception handling. */
+bool gfc_eh_initialized_p;
+
+
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
or validate its data type for an `if' or `while' statement or ?..: exp.
@@ -1223,5 +1231,21 @@ gfc_init_ts (void)
tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
}
+void
+gfc_maybe_initialize_eh (void)
+{
+ if (!flag_exceptions || gfc_eh_initialized_p)
+ return;
+
+ gfc_eh_initialized_p = true;
+ eh_personality_libfunc
+ = init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ ? "__gcc_personality_sj0"
+ : "__gcc_personality_v0");
+ default_init_unwind_resume_libfunc ();
+ using_eh_for_cleanups ();
+}
+
+
#include "gt-fortran-f95-lang.h"
#include "gtype-fortran.h"
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 86f2c5b..bc066bc 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2198,6 +2198,9 @@ unsigned int gfc_init_options (unsigned int, const char **);
int gfc_handle_option (size_t, const char *, int);
bool gfc_post_options (const char **);
+/* f95-lang.c */
+void gfc_maybe_initialize_eh (void);
+
/* iresolve.c */
const char * gfc_get_string (const char *, ...) ATTRIBUTE_PRINTF_1;
bool gfc_find_sym_in_expr (gfc_symbol *, gfc_expr *);
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index 136b751..94d61c9 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -42,22 +42,15 @@ gfc_getmem (size_t n)
}
-/* gfortran.h defines free to something that triggers a syntax error,
- but we need free() here. */
-
-#define temp free
-#undef free
-
void
gfc_free (void *p)
{
+ /* The parentheses around free are needed in order to call not
+ the redefined free of gfortran.h. */
if (p != NULL)
- free (p);
+ (free) (p);
}
-#define free temp
-#undef temp
-
/* Get terminal width. */
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 0e9dda8..608d605 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -1503,6 +1503,9 @@ resolve_omp_do (gfc_code *code)
void
gfc_resolve_omp_directive (gfc_code *code, gfc_namespace *ns ATTRIBUTE_UNUSED)
{
+ if (code->op != EXEC_OMP_ATOMIC)
+ gfc_maybe_initialize_eh ();
+
switch (code->op)
{
case EXEC_OMP_DO: