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
This commit is contained in:
parent
238564598b
commit
5c386a95ee
6 changed files with 49 additions and 10 deletions
|
@ -1,5 +1,12 @@
|
|||
2006-11-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
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.
|
||||
|
||||
PR c/29736
|
||||
* c-common.c (handle_vector_size_attribute): Disallow VECTOR_TYPE
|
||||
or UNION_TYPE inner types.
|
||||
|
|
28
gcc/c-decl.c
28
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);
|
||||
}
|
||||
|
|
|
@ -7755,6 +7755,12 @@ c_parser_omp_construct (c_parser *parser)
|
|||
p_kind = c_parser_peek_token (parser)->pragma_kind;
|
||||
c_parser_consume_pragma (parser);
|
||||
|
||||
/* For all constructs below except #pragma omp atomic
|
||||
MUST_NOT_THROW catch handlers are needed when exceptions
|
||||
are enabled. */
|
||||
if (p_kind != PRAGMA_OMP_ATOMIC)
|
||||
c_maybe_initialize_eh ();
|
||||
|
||||
switch (p_kind)
|
||||
{
|
||||
case PRAGMA_OMP_ATOMIC:
|
||||
|
|
|
@ -456,6 +456,7 @@ extern void declare_parm_level (void);
|
|||
extern void undeclared_variable (tree, location_t);
|
||||
extern tree declare_label (tree);
|
||||
extern tree define_label (location_t, tree);
|
||||
extern void c_maybe_initialize_eh (void);
|
||||
extern void finish_decl (tree, tree, tree);
|
||||
extern tree finish_enum (tree, tree, tree);
|
||||
extern void finish_function (void);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2006-11-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/29955
|
||||
* gcc.dg/gomp/pr29955.c: New test.
|
||||
|
||||
PR c/29736
|
||||
* gcc.dg/pr29736.c: New test.
|
||||
|
||||
|
|
14
gcc/testsuite/gcc.dg/gomp/pr29955.c
Normal file
14
gcc/testsuite/gcc.dg/gomp/pr29955.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* PR c/29955 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fopenmp -fexceptions" } */
|
||||
|
||||
extern void bar (int);
|
||||
|
||||
void
|
||||
foo (int n)
|
||||
{
|
||||
int i;
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (i = 0; i < n; i++)
|
||||
bar (0);
|
||||
}
|
Loading…
Add table
Reference in a new issue