On Thu, Jul 09, 2015 at 10:16:38AM +0200, Richard Biener wrote:
> On Wed, Jul 8, 2015 at 5:32 PM, H.J. Lu <[email protected]> wrote:
> > There is no need to try different alignment on variable of
> > error_mark_node.
> >
> > OK for trunk if there is no regression?
>
> Can't we avoid calling align_variable on error_mark_node type decls
> completely? That is, punt earlier when we try to emit it.
>
How about this? OK for trunk?
H.J.
---
There is no need to analyze error_mark_node type decls.
gcc/
PR target/66810
* varpool.cvarpool.c (varpool_node::analyze): Skip
error_mark_node type decls.
gcc/testsuite/
PR target/66810
* gcc.target/i386/pr66810.c: New test.
---
gcc/testsuite/gcc.target/i386/pr66810.c | 10 ++++++++++
gcc/varpool.c | 29 +++++++++++++++++------------
2 files changed, 27 insertions(+), 12 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/i386/pr66810.c
diff --git a/gcc/testsuite/gcc.target/i386/pr66810.c
b/gcc/testsuite/gcc.target/i386/pr66810.c
new file mode 100644
index 0000000..4778b37
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr66810.c
@@ -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" } */
+}
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 10fa93c..f7c4d46 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -514,20 +514,25 @@ varpool_node::get_availability (void)
void
varpool_node::analyze (void)
{
- /* When reading back varpool at LTO time, we re-construct the queue in order
- to have "needed" list right by inserting all needed nodes into varpool.
- We however don't want to re-analyze already analyzed nodes. */
- if (!analyzed)
+ /* Skip error_mark_node type decls. */
+ if (TREE_TYPE (decl) != error_mark_node)
{
- gcc_assert (!in_lto_p || symtab->function_flags_ready);
- /* Compute the alignment early so function body expanders are
- already informed about increased alignment. */
- align_variable (decl, 0);
+ /* When reading back varpool at LTO time, we re-construct the
+ queue in order to have "needed" list right by inserting all
+ needed nodes into varpool. We however don't want to re-analyze
+ already analyzed nodes. */
+ if (!analyzed)
+ {
+ gcc_assert (!in_lto_p || symtab->function_flags_ready);
+ /* Compute the alignment early so function body expanders are
+ already informed about increased alignment. */
+ align_variable (decl, 0);
+ }
+ if (alias)
+ resolve_alias (varpool_node::get (alias_target));
+ else if (DECL_INITIAL (decl))
+ record_references_in_initializer (decl, analyzed);
}
- if (alias)
- resolve_alias (varpool_node::get (alias_target));
- else if (DECL_INITIAL (decl))
- record_references_in_initializer (decl, analyzed);
analyzed = true;
}
--
2.4.3