From c17d0de1ad09ec0868a72a0d45861c617d74b0fe Mon Sep 17 00:00:00 2001 From: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Sun, 15 Oct 2006 16:20:06 +0000 Subject: [PATCH] PR middle-end/29299 * cgraphunit.c (cgraph_finalize_compilation_unit): Call process_function_and_variable_attributes on all variables, including those discovered during cgraph construction phase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117746 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/cgraphunit.c | 16 ++++++++++++---- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/pr29299.c | 10 ++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr29299.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c36c0e17501..bf63002e460e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-10-15 Jan Hubicka <jh@suse.cz> + Richard Guenther <rguenther@suse.de> + + PR middle-end/29299 + * cgraphunit.c (cgraph_finalize_compilation_unit): Call + process_function_and_variable_attributes on all variables, including + those discovered during cgraph construction phase. + 2006-10-15 Bernhard Fischer <aldot@gcc.gnu.org> * final.c: Update Copyright year. Commentary typo fix. Fix whitespace diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 10c52ea42849..d7ad793db5b9 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1055,6 +1055,7 @@ cgraph_finalize_compilation_unit (void) /* Keep track of already processed nodes when called multiple times for intermodule optimization. */ static struct cgraph_node *first_analyzed; + struct cgraph_node *first_processed = first_analyzed; static struct cgraph_varpool_node *first_analyzed_var; if (errorcount || sorrycount) @@ -1077,7 +1078,10 @@ cgraph_finalize_compilation_unit (void) } timevar_push (TV_CGRAPH); - process_function_and_variable_attributes (first_analyzed, first_analyzed_var); + process_function_and_variable_attributes (first_processed, + first_analyzed_var); + first_processed = cgraph_nodes; + first_analyzed_var = cgraph_varpool_nodes; cgraph_varpool_analyze_pending_decls (); if (cgraph_dump_file) { @@ -1119,11 +1123,16 @@ cgraph_finalize_compilation_unit (void) if (!edge->callee->reachable) cgraph_mark_reachable_node (edge->callee); + /* We finalize local static variables during constructing callgraph + edges. Process their attributes too. */ + process_function_and_variable_attributes (first_processed, + first_analyzed_var); + first_processed = cgraph_nodes; + first_analyzed_var = cgraph_varpool_nodes; cgraph_varpool_analyze_pending_decls (); } - /* Collect entry points to the unit. */ - +/bin/bash: line 1: :Q: command not found if (cgraph_dump_file) { fprintf (cgraph_dump_file, "Unit entry points:"); @@ -1163,7 +1172,6 @@ cgraph_finalize_compilation_unit (void) dump_cgraph (cgraph_dump_file); } first_analyzed = cgraph_nodes; - first_analyzed_var = cgraph_varpool_nodes; ggc_collect (); timevar_pop (TV_CGRAPH); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 81eec2138872..c2ff6c22b40f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2006-10-15 Richard Guenther <rguenther@suse.de> + + * gcc.dg/pr29299.c: New testcase. + 2006-10-15 Bernhard Fischer <aldot@gcc.gnu.org> PR fortran/24767 diff --git a/gcc/testsuite/gcc.dg/pr29299.c b/gcc/testsuite/gcc.dg/pr29299.c new file mode 100644 index 000000000000..9049060fae45 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr29299.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +static int bof __attribute__((used)); +int foo() +{ + static int barbarbarbar __attribute__((used)); +}; + +/* { dg-final { scan-assembler "barbarbarbar" } } */ -- GitLab