Skip local error_mark_node decls
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 20 Oct 2015 15:20:29 +0000 (15:20 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 20 Oct 2015 15:20:29 +0000 (08:20 -0700)
There is no need to finalize local error_mark_node decls.

gcc/

PR target/66810
* cgraphbuild.c (pass_build_cgraph_edges::execute): Skip local
error_mark_node decls.

gcc/testsuite/

PR target/66810
* gcc.target/i386/pr66810.c: New test.

From-SVN: r229083

gcc/ChangeLog
gcc/cgraphbuild.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr66810.c [new file with mode: 0644]

index e3394723d7de1ec355bf5c1f286e2496d8e3daea..44760d417347e6206d958afc3e66c64abb1410fb 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/66810
+       * cgraphbuild.c (pass_build_cgraph_edges::execute): Skip local
+       error_mark_node decls.
+
 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/67963
index 33b01be83acfdd456514aaaf9cbb66ed1664ca86..b0815c987cb568d4d7a67edb7b01ee26131cfe8d 100644 (file)
@@ -381,7 +381,8 @@ pass_build_cgraph_edges::execute (function *fun)
   FOR_EACH_LOCAL_DECL (fun, ix, decl)
     if (TREE_CODE (decl) == VAR_DECL
        && (TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
-       && !DECL_HAS_VALUE_EXPR_P (decl))
+       && !DECL_HAS_VALUE_EXPR_P (decl)
+       && TREE_TYPE (decl) != error_mark_node)
       varpool_node::finalize_decl (decl);
   record_eh_tables (node, fun);
 
index 7d4c6f83276c40a4e7da049fe5803905232e4247..1d8f1cb8c9ecc53839b8090642ee15249ca6ba1c 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/66810
+       * gcc.target/i386/pr66810.c: New test.
+
 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/67963
diff --git a/gcc/testsuite/gcc.target/i386/pr66810.c b/gcc/testsuite/gcc.target/i386/pr66810.c
new file mode 100644 (file)
index 0000000..4778b37
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-mno-sse -mno-mmx -miamcu" } */
+
+int vv;
+
+void
+i (void)
+{
+  static int a[vv]; /* { dg-error "storage size" } */
+}