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
This commit is contained in:
Jakub Jelinek 2008-04-15 17:09:42 +02:00
parent 4d6baa57a4
commit b97d81535d
7 changed files with 131 additions and 39 deletions

View file

@ -1,6 +1,12 @@
2008-04-15 Jakub Jelinek <jakub@redhat.com>
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 <espindola@google.com>
* 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 <rguenther@suse.de>
@ -140,7 +146,7 @@
2008-04-10 Rafael Espindola <espindola@google.com>
* 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 <kai.tietz@onevision.com>
* 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 <rguenther@suse.de>
@ -2449,7 +2455,7 @@
2008-03-15 Bjoern Haase <bjoern.m.haase@web.de>
Anatoly Sokolov <aesok@post.ru>
* 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.

View file

@ -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))

View file

@ -1,3 +1,9 @@
2008-04-15 Jakub Jelinek <jakub@redhat.com>
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 <dannysmith@users.sourceforge.net>
PR target/35921
@ -2334,7 +2340,7 @@
2007-09-05 Jan Hubicka <jh@suse.cz>
* 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 <pcarlini@suse.de>
@ -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 <aaw@google.com>
@ -3434,7 +3440,7 @@
2007-05-11 Silvius Rus <rus@google.com>
* 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 <jh@suse.cz>
* 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 <andrew_pinski@playstation.sony.com>
@ -3546,7 +3552,7 @@
2007-04-16 Seongbae Park <seongbae.park@gmail.com>
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 <mark@codesourcery.com>
@ -3565,7 +3571,7 @@
2007-04-11 Jan Hubicka <jh@suse.cz>
* 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 <mark@codesourcery.com>
@ -3820,7 +3826,7 @@
2007-03-14 Dirk Mueller <dmueller@suse.de>
* 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 <manu@gcc.gnu.org>
@ -3835,7 +3841,7 @@
2007-03-13 Alexandre Oliva <aoliva@redhat.com>
* 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 <mark@codesourcery.com>
@ -4089,7 +4095,7 @@
2007-03-09 Dirk Mueller <dmueller@suse.de>
* cp/call.c (build_new_op): Call warn_logical_operator.
* call.c (build_new_op): Call warn_logical_operator.
2007-03-08 Volker Reichelt <reichelt@netcologne.de>

View file

@ -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;
}
}
}

View file

@ -1,3 +1,9 @@
2008-04-15 Jakub Jelinek <jakub@redhat.com>
PR c/35751
* gcc.dg/gomp/pr35751.c: New test.
* g++.dg/gomp/pr35751.C: New test.
2008-04-15 Samuel Tardieu <sam@rfc1149.net>
PR ada/16086
@ -1458,7 +1464,7 @@
2008-02-29 Sebastian Pop <sebastian.pop@amd.com>
* 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 <franke.daniel@gmail.com>
@ -1481,20 +1487,20 @@
2008-02-28 Sebastian Pop <sebastian.pop@amd.com>
* 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 <ubizjak@gmail.com>
@ -1974,7 +1980,7 @@
2008-02-15 Dominique d'Humieres <dominiq@lps.ens.fr>
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 <ubizjak@gmail.com>
@ -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 <franke.daniel@gmail.com>
@ -2767,7 +2773,7 @@
2008-01-18 Jonathan Wakely <jwakely.gcc@gmail.com>
* gcc/testsuite/g++.dg/lookup/two-stage2.C: fix comment.
* g++.dg/lookup/two-stage2.C: fix comment.
2008-01-18 Ian Lance Taylor <iant@google.com>
@ -4430,7 +4436,7 @@
2007-11-20 Richard Guenther <rguenther@suse.de>
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 <ubizjak@gmail.com>

View file

@ -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;
}
}

View file

@ -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;
}
}