From b97d81535d07cfb6d1275f9c83d88af0dec96cd0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 15 Apr 2008 17:09:42 +0200 Subject: [PATCH] re PR c/35751 (ICE with invalid variable after #pragma omp parallel) PR c/35751 * c-decl.c (finish_decl): If extern or static var has variable size, set TREE_TYPE (decl) to error_mark_node. * decl.c (layout_var_decl): If extern or static var has variable size, set TREE_TYPE (decl) to error_mark_node. * gcc.dg/gomp/pr35751.c: New test. * g++.dg/gomp/pr35751.C: New test. From-SVN: r134317 --- gcc/ChangeLog | 24 ++++++++++------ gcc/c-decl.c | 5 +++- gcc/cp/ChangeLog | 24 ++++++++++------ gcc/cp/decl.c | 5 +++- gcc/testsuite/ChangeLog | 44 ++++++++++++++++------------- gcc/testsuite/g++.dg/gomp/pr35751.C | 34 ++++++++++++++++++++++ gcc/testsuite/gcc.dg/gomp/pr35751.c | 34 ++++++++++++++++++++++ 7 files changed, 131 insertions(+), 39 deletions(-) create mode 100644 gcc/testsuite/g++.dg/gomp/pr35751.C create mode 100644 gcc/testsuite/gcc.dg/gomp/pr35751.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec2c81185b4..f2c5442eb7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ +2008-04-15 Jakub Jelinek + + PR c/35751 + * c-decl.c (finish_decl): If extern or static var has variable + size, set TREE_TYPE (decl) to error_mark_node. + 2008-04-15 Rafael Espindola - * gcc/fold-const.c (tree_call_nonnegative_warnv_p): Remove local + * fold-const.c (tree_call_nonnegative_warnv_p): Remove local variable arg1. 2008-04-15 Richard Guenther @@ -140,7 +146,7 @@ 2008-04-10 Rafael Espindola - * gcc/tree-vrp.c (extract_range_from_binary_expr): Don't handle + * tree-vrp.c (extract_range_from_binary_expr): Don't handle TRUTH_ANDIF_EXPR or TRUTH_ORIF_EXPR. (extract_range_from_expr): The same. @@ -1057,9 +1063,9 @@ 2008-04-02 Kai Tietz * config.gcc: Add for x86_64-*-mingw* the t-crtfm to tbuild. - * gcc/config/i386/cygming.h (ASM_OUTPUT_DWARF_OFFSET): Add 8 byte + * config/i386/cygming.h (ASM_OUTPUT_DWARF_OFFSET): Add 8 byte offsets for 64-bit mingw. - * gcc/config/i386/i386.c (ix86_pass_by_reference): Correct calling + * config/i386/i386.c (ix86_pass_by_reference): Correct calling abi for x86_64-pc-mingw. 2008-04-02 Richard Guenther @@ -2449,7 +2455,7 @@ 2008-03-15 Bjoern Haase Anatoly Sokolov - * gcc/gcc/config/avr/avr.c (avr_arch_types): Add avr6 entry. + * config/avr/avr.c (avr_arch_types): Add avr6 entry. (avr_arch): Add ARCH_AVR6. (avr_mcu_types): Add 'atmega2560' and 'atmega2561' entry. (initial_elimination_offset): Initialize and use 'avr_pc_size' @@ -2458,7 +2464,7 @@ (avr_assemble_integer): (Ditto.). (avr_output_addr_vec_elt): (Ditto.). (print_operand): Handle "!" code. - * gcc/gcc/config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Add + * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Add __AVR_3_BYTE_PC__, __AVR_2_BYTE_PC__ and __AVR_HAVE_JMP_CALL__. (AVR_HAVE_EIJMP_EICALL): Define. (AVR_3_BYTE_PC): Redefine. @@ -2467,7 +2473,7 @@ (LINK_SPEC): Add atmega2560 and atmega2561. (CRT_BINUTILS_SPEC): Add atmega2560 (crtm2560.o) and atmega2561 (crtm2561.o). - * gcc/gcc/config/avr/avr.md (call_insn): Use eicall instead of icall + * config/avr/avr.md (call_insn): Use eicall instead of icall for 3 byte PC devices. (call_value_insn): (Ditto.). (*tablejump_enh): Use eijmp instead of ijmp for 3 byte PC devices. @@ -2475,10 +2481,10 @@ (*tablejump): (Ditto.). (*indirect_jump_avr6): Add insn. (*tablejump_rjmp): Don't use for 3 byte PC devices. - * gcc/gcc/config/avr/libgcc.S (__prologue_saves__): Use eijmp + * config/avr/libgcc.S (__prologue_saves__): Use eijmp instead of ijmp for 3 byte PC devices. (__tablejump2__): (Ditto.). - * gcc/gcc/config/avr/t-avr (MULITLIB_OPTIONS): Add avr6 architecture. + * config/avr/t-avr (MULITLIB_OPTIONS): Add avr6 architecture. (MULITLIB_DIRNAMES): (Ditto.). (MULTILIB_MATCHES): Add atmega2560 and atmega2561 to list. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 22491aaec6a..872fb8af30b 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3481,7 +3481,10 @@ finish_decl (tree decl, tree init, tree asmspec_tree) if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) constant_expression_warning (DECL_SIZE (decl)); else - error ("storage size of %q+D isn%'t constant", decl); + { + error ("storage size of %q+D isn%'t constant", decl); + TREE_TYPE (decl) = error_mark_node; + } } if (TREE_USED (type)) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cee41d5fbdb..22a7420523d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-15 Jakub Jelinek + + PR c/35751 + * decl.c (layout_var_decl): If extern or static var has variable + size, set TREE_TYPE (decl) to error_mark_node. + 2008-04-16 Danny Smith PR target/35921 @@ -2334,7 +2340,7 @@ 2007-09-05 Jan Hubicka - * cp/sematics.c (expand_body): Remove unnecesary import_export_decl + * sematics.c (expand_body): Remove unnecesary import_export_decl call, DECL_EXTERNAL checks and current_function_decl saving. 2007-09-05 Paolo Carlini @@ -2761,7 +2767,7 @@ * cp-objcp-common.c (cxx_get_alias_set): Change return type to alias_set_type. - * cp/cp-tree.h (cxx_get_alias_set): Update declaration. + * cp-tree.h (cxx_get_alias_set): Update declaration. 2007-08-10 Ollie Wild @@ -3434,7 +3440,7 @@ 2007-05-11 Silvius Rus - * cp/typeck.c (build_indirect_ref): Add call to + * typeck.c (build_indirect_ref): Add call to strict_aliasing_warning. (build_reinterpret_cast_1): Condition call to strict_aliasing_warning. @@ -3524,7 +3530,7 @@ 2007-04-23 Jan Hubicka - * cp/decl2.c (finish_objects): Do not call target constructor/destructor + * decl2.c (finish_objects): Do not call target constructor/destructor bits dirrectly. 2007-04-21 Andrew Pinski @@ -3546,7 +3552,7 @@ 2007-04-16 Seongbae Park PR c++/29365 - * cp/decl2.c (constrain_class_visibility): + * decl2.c (constrain_class_visibility): Do not warn about the use of anonymous namespace in the main input file. 2007-04-15 Mark Mitchell @@ -3565,7 +3571,7 @@ 2007-04-11 Jan Hubicka - * cp/class.c (convert_to_base_statically): Fold produced tree; verify + * class.c (convert_to_base_statically): Fold produced tree; verify that we are not processing template_decl. 2007-04-09 Mark Mitchell @@ -3820,7 +3826,7 @@ 2007-03-14 Dirk Mueller - * cp/semantics.c (c_finish_if_stmt): Call empty_if_body_warning. + * semantics.c (c_finish_if_stmt): Call empty_if_body_warning. (finish_do_body): Warn about empty body in do/while statement. 2007-03-14 Manuel Lopez-Ibanez @@ -3835,7 +3841,7 @@ 2007-03-13 Alexandre Oliva - * cp/repo.c (init_repo): Initialize random_seed saved options. + * repo.c (init_repo): Initialize random_seed saved options. (finish_repo): Adjust. 2007-03-13 Mark Mitchell @@ -4089,7 +4095,7 @@ 2007-03-09 Dirk Mueller - * cp/call.c (build_new_op): Call warn_logical_operator. + * call.c (build_new_op): Call warn_logical_operator. 2007-03-08 Volker Reichelt diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ccdcf379544..66e8f426b63 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4442,7 +4442,10 @@ layout_var_decl (tree decl) if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST) constant_expression_warning (DECL_SIZE (decl)); else - error ("storage size of %qD isn't constant", decl); + { + error ("storage size of %qD isn't constant", decl); + TREE_TYPE (decl) = error_mark_node; + } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e3350a80c8e..892576ed4b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-15 Jakub Jelinek + + PR c/35751 + * gcc.dg/gomp/pr35751.c: New test. + * g++.dg/gomp/pr35751.C: New test. + 2008-04-15 Samuel Tardieu PR ada/16086 @@ -1458,7 +1464,7 @@ 2008-02-29 Sebastian Pop - * testsuite/gcc.dg/tree-ssa/ltrans-8.c: Increase the size of strides + * gcc.dg/tree-ssa/ltrans-8.c: Increase the size of strides to make the interchange profitable. 2008-02-28 Daniel Franke @@ -1481,20 +1487,20 @@ 2008-02-28 Sebastian Pop - * testsuite/gcc.dg/tree-ssa/ldist-1.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-1a.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-2.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-3.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-4.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-5.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-6.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-7.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-8.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-9.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-10.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-11.c: New. - * testsuite/gcc.dg/tree-ssa/ldist-12.c: New. - * testsuite/gfortran.dg/ldist-1.f90: New. + * gcc.dg/tree-ssa/ldist-1.c: New. + * gcc.dg/tree-ssa/ldist-1a.c: New. + * gcc.dg/tree-ssa/ldist-2.c: New. + * gcc.dg/tree-ssa/ldist-3.c: New. + * gcc.dg/tree-ssa/ldist-4.c: New. + * gcc.dg/tree-ssa/ldist-5.c: New. + * gcc.dg/tree-ssa/ldist-6.c: New. + * gcc.dg/tree-ssa/ldist-7.c: New. + * gcc.dg/tree-ssa/ldist-8.c: New. + * gcc.dg/tree-ssa/ldist-9.c: New. + * gcc.dg/tree-ssa/ldist-10.c: New. + * gcc.dg/tree-ssa/ldist-11.c: New. + * gcc.dg/tree-ssa/ldist-12.c: New. + * gfortran.dg/ldist-1.f90: New. 2008-02-28 Uros Bizjak @@ -1974,7 +1980,7 @@ 2008-02-15 Dominique d'Humieres PR testsuite/35119 - * testsuite/g++.dg/template/spec35.C: Change the regular expressions + * g++.dg/template/spec35.C: Change the regular expressions in dg-final to match the assembly code generated by Darwin 9. 2008-02-15 Uros Bizjak @@ -2182,7 +2188,7 @@ http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00110.html PR 33738 - * testsuite/g++.dg/warn/pr33738.C: New. + * g++.dg/warn/pr33738.C: New. 2008-02-04 Daniel Franke @@ -2767,7 +2773,7 @@ 2008-01-18 Jonathan Wakely - * gcc/testsuite/g++.dg/lookup/two-stage2.C: fix comment. + * g++.dg/lookup/two-stage2.C: fix comment. 2008-01-18 Ian Lance Taylor @@ -4430,7 +4436,7 @@ 2007-11-20 Richard Guenther PR middle-end/34154 - * testsuite/gcc.c-torture/execute/pr34154.c: New testcase. + * gcc.c-torture/execute/pr34154.c: New testcase. 2007-11-20 Uros Bizjak diff --git a/gcc/testsuite/g++.dg/gomp/pr35751.C b/gcc/testsuite/g++.dg/gomp/pr35751.C new file mode 100644 index 00000000000..0b6cded5929 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr35751.C @@ -0,0 +1,34 @@ +// PR c/35751 +// { dg-do compile } +// { dg-options "-fopenmp" } + +void +foo (int i) +{ + extern int a[i]; // { dg-error "storage size of" } + static int b[i]; // { dg-error "storage size of" } + +#pragma omp parallel + { + a[0] = 0; + b[0] = 0; + } + +#pragma omp parallel shared (a, b) + { + a[0] = 0; + b[0] = 0; + } + +#pragma omp parallel private (a, b) + { + a[0] = 0; + b[0] = 0; + } + +#pragma omp parallel firstprivate (a, b) + { + a[0] = 0; + b[0] = 0; + } +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr35751.c b/gcc/testsuite/gcc.dg/gomp/pr35751.c new file mode 100644 index 00000000000..f7777a5b79a --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr35751.c @@ -0,0 +1,34 @@ +/* PR c/35751 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int i) +{ + extern int a[i]; /* { dg-error "must have no linkage|storage size of" } */ + static int b[i]; /* { dg-error "storage size of" } */ + +#pragma omp parallel + { + a[0] = 0; + b[0] = 0; + } + +#pragma omp parallel shared (a, b) + { + a[0] = 0; + b[0] = 0; + } + +#pragma omp parallel private (a, b) + { + a[0] = 0; + b[0] = 0; + } + +#pragma omp parallel firstprivate (a, b) + { + a[0] = 0; + b[0] = 0; + } +} -- 2.30.2