From: Jakub Jelinek Date: Fri, 17 Jan 2014 14:19:55 +0000 (+0100) Subject: re PR c++/57945 (ICE: in varpool_get_node, at cgraph.h:840) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=24fcf4bc0c6ac701e9c2e1ae1f92908c50afd11f;p=gcc.git re PR c++/57945 (ICE: in varpool_get_node, at cgraph.h:840) PR c++/57945 * passes.c (rest_of_decl_compilation): Don't call varpool_finalize_decl on decls for which assemble_alias has been called. * c-c++-common/torture/pr57945.c: New test. From-SVN: r206708 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6b76927cc2..239d6d6d629 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-01-17 Jan Hubicka + + PR c++/57945 + * passes.c (rest_of_decl_compilation): Don't call varpool_finalize_decl + on decls for which assemble_alias has been called. + 2014-01-17 Nick Clifton * config/msp430/msp430.opt: (mcpu): New option. diff --git a/gcc/passes.c b/gcc/passes.c index 3b340d3a546..60fb13536fa 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -187,6 +187,8 @@ rest_of_decl_compilation (tree decl, int top_level, int at_end) { + bool finalize = true; + /* We deferred calling assemble_alias so that we could collect other attributes such as visibility. Emit the alias now. */ if (!in_lto_p) @@ -203,6 +205,7 @@ rest_of_decl_compilation (tree decl, DECL_EXTERNAL (decl) = 0; TREE_STATIC (decl) = 1; assemble_alias (decl, alias); + finalize = false; } } @@ -234,7 +237,7 @@ rest_of_decl_compilation (tree decl, rebuild it. */ if (in_lto_p && !at_end) ; - else if (TREE_CODE (decl) != FUNCTION_DECL) + else if (finalize && TREE_CODE (decl) != FUNCTION_DECL) varpool_finalize_decl (decl); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 665d9034d27..b5c9a2521d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-17 Jakub Jelinek + + PR c++/57945 + * c-c++-common/torture/pr57945.c: New test. + 2014-01-17 Zhenqiang Chen * gcc.target/arm/its.c: New testcase. diff --git a/gcc/testsuite/c-c++-common/torture/pr57945.c b/gcc/testsuite/c-c++-common/torture/pr57945.c new file mode 100644 index 00000000000..0803e8ff21f --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/pr57945.c @@ -0,0 +1,11 @@ +/* PR c++/57945 */ +/* { dg-do compile } */ + +extern int j; +static int i __attribute__((weakref("j"))); + +int +foo (void) +{ + return &i ? i : 0; +}