re PR c/35751 (ICE with invalid variable after #pragma omp parallel)
authorJakub Jelinek <jakub@gcc.gnu.org>
Tue, 15 Apr 2008 15:09:42 +0000 (17:09 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 15 Apr 2008 15:09:42 +0000 (17:09 +0200)
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
gcc/c-decl.c
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr35751.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/pr35751.c [new file with mode: 0644]

index ec2c811..f2c5442 100644 (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>
 
 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.
 
 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>
 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' 
        (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.
        (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.
        (*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.
 
index 22491aa..872fb8a 100644 (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))
index cee41d5..22a7420 100644 (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
 
 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>
 
        * 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>
 
 
 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. 
 
 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>
 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>
 
 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>
 
 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>
        
 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>
 
 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>
 
index ccdcf37..66e8f42 100644 (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;
+       }
     }
 }
 
index e3350a8..892576e 100644 (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
 
 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>
 
 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>
 
 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>
        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>
 
 
 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>
 
 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>
 
diff --git a/gcc/testsuite/g++.dg/gomp/pr35751.C b/gcc/testsuite/g++.dg/gomp/pr35751.C
new file mode 100644 (file)
index 0000000..0b6cded
--- /dev/null
@@ -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 (file)
index 0000000..f7777a5
--- /dev/null
@@ -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;
+  }
+}