This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix g++.dg/parse/attr-externally-visible-1.C for darwin


This is just like first-global.C it turns out.  Essentially, -fPIC has
notice_global_symbol checking more decls, and that routine does:

 || !MEM_P (DECL_RTL (decl)))

which creates rtl which causes varpool_remove_unreferenced_decls's check:

=>    if (node->finalized
          && (decide_is_variable_needed (node, decl)
              /* ??? Cgraph does not yet rule the world with an iron hand,                                               
                 and does not control the emission of debug information.                                                 
                 After a variable has its DECL_RTL set, we must assume that                                              
                 it may be referenced by the debug information, and we can                                               
                 no longer elide it.  */
              || DECL_RTL_SET_P (decl)))
        varpool_mark_needed_node (node);

to mark it as neeed which prevents bar6 the testcase:

// { dg-do compile }
// { dg-options "-O3 -fwhole-program" }
// { dg-final { scan-assembler-not "foo6" } }
// { dg-final { scan-assembler-not "bar6" } }

void foo6 (void) { }

char *bar6;

int main (void) { }

from being eliminated because it is needed.  With this, we should be
able to get down to 0 `regressions' on Geoff's checker again.

Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 124587)
+++ testsuite/ChangeLog	(working copy)
@@ -1,6 +1,7 @@
 2007-05-09  Mike Stump  <mrs@apple.com>
 
 	* g++.dg/other/first-global.C: Add -fpie for darwin.
+	* g++.dg/parse/attr-externally-visible-1.C: Likewise.
 
 2007-05-09  Andreas Krebbel  <krebbel1@de.ibm.com>
 
Index: testsuite/g++.dg/parse/attr-externally-visible-1.C
===================================================================
--- testsuite/g++.dg/parse/attr-externally-visible-1.C	(revision 124587)
+++ testsuite/g++.dg/parse/attr-externally-visible-1.C	(working copy)
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-O3 -fwhole-program" }
+/* { dg-options "-O3 -fwhole-program -fpie" { target *-*-darwin* } } */
 // { dg-final { scan-assembler "foo1" } }
 // { dg-final { scan-assembler "foo2" } }
 // { dg-final { scan-assembler "foo3" } }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]