aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-11-24 22:28:38 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2006-11-24 22:28:38 +0100
commit5c386a95ee20b9bb8f705ed1f8394ca7b4bafa7d (patch)
tree36c8035a96cc911760ed8fd295e9fcba32d8a983 /gcc/c-decl.c
parent238564598bce2cc56d65382076806f3ca73af4de (diff)
downloadgcc-5c386a95ee20b9bb8f705ed1f8394ca7b4bafa7d.zip
gcc-5c386a95ee20b9bb8f705ed1f8394ca7b4bafa7d.tar.gz
gcc-5c386a95ee20b9bb8f705ed1f8394ca7b4bafa7d.tar.bz2
re PR c/29955 (ICE with -fopenmp -fexceptions)
PR c/29955 * c-tree.h (c_maybe_initialize_eh): New prototype. * c-decl.c (finish_decl): Move EH initialization... (c_maybe_initialize_eh): ... here. New function. * c-parser.c (c_parser_omp_construct): Call c_maybe_initialize_eh if not #pragma omp atomic. * gcc.dg/gomp/pr29955.c: New test. From-SVN: r119168
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 80f1a1a..fa1c340 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3385,6 +3385,23 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
return tem;
}
+/* Initialize EH if not initialized yet and exceptions are enabled. */
+
+void
+c_maybe_initialize_eh (void)
+{
+ if (!flag_exceptions || c_eh_initialized_p)
+ return;
+
+ c_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 ();
+}
+
/* Finish processing of a declaration;
install its initial value.
If the length of an array type is not known before,
@@ -3676,16 +3693,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
TREE_USED (cleanup_decl) = 1;
/* Initialize EH, if we've been told to do so. */
- if (flag_exceptions && !c_eh_initialized_p)
- {
- c_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 ();
- }
+ c_maybe_initialize_eh ();
push_cleanup (decl, cleanup, false);
}