mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-13 05:43:45 +08:00
re PR tree-optimization/42625 (-fipa-sra can generate different destructors in different object files, binary breaks after linking)
PR tree-optimization/42625 * cgraph.c (cgraph_make_node_local): Clear DECL_COMDAT*, TREE_PUBLIC, DECL_WEAK and DECL_EXTERNAL also for same_body aliases. * g++.dg/opt/dtor4.C: New test. * g++.dg/opt/dtor4.h: New. * g++.dg/opt/dtor4-aux.cc: New. From-SVN: r155694
This commit is contained in:
parent
01094033c6
commit
4139c7ef40
@ -1,3 +1,10 @@
|
||||
2010-01-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/42625
|
||||
* cgraph.c (cgraph_make_node_local): Clear DECL_COMDAT*,
|
||||
TREE_PUBLIC, DECL_WEAK and DECL_EXTERNAL also for same_body
|
||||
aliases.
|
||||
|
||||
2010-01-07 Duncan Sands <baldrick@free.fr>
|
||||
|
||||
* Makefile.in (PLUGIN_HEADERS): Add version.h.
|
||||
|
11
gcc/cgraph.c
11
gcc/cgraph.c
@ -1,5 +1,5 @@
|
||||
/* Callgraph handling code.
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Jan Hubicka
|
||||
|
||||
@ -2197,11 +2197,20 @@ cgraph_make_node_local (struct cgraph_node *node)
|
||||
gcc_assert (cgraph_node_can_be_local_p (node));
|
||||
if (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))
|
||||
{
|
||||
struct cgraph_node *alias;
|
||||
DECL_COMDAT (node->decl) = 0;
|
||||
DECL_COMDAT_GROUP (node->decl) = 0;
|
||||
TREE_PUBLIC (node->decl) = 0;
|
||||
DECL_WEAK (node->decl) = 0;
|
||||
DECL_EXTERNAL (node->decl) = 0;
|
||||
for (alias = node->same_body; alias; alias = alias->next)
|
||||
{
|
||||
DECL_COMDAT (alias->decl) = 0;
|
||||
DECL_COMDAT_GROUP (alias->decl) = 0;
|
||||
TREE_PUBLIC (alias->decl) = 0;
|
||||
DECL_WEAK (alias->decl) = 0;
|
||||
DECL_EXTERNAL (alias->decl) = 0;
|
||||
}
|
||||
node->local.externally_visible = false;
|
||||
node->local.local = true;
|
||||
gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL);
|
||||
|
@ -1,3 +1,10 @@
|
||||
2010-01-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/42625
|
||||
* g++.dg/opt/dtor4.C: New test.
|
||||
* g++.dg/opt/dtor4.h: New.
|
||||
* g++.dg/opt/dtor4-aux.cc: New.
|
||||
|
||||
2010-01-07 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/42597
|
||||
|
6
gcc/testsuite/g++.dg/opt/dtor4-aux.cc
Normal file
6
gcc/testsuite/g++.dg/opt/dtor4-aux.cc
Normal file
@ -0,0 +1,6 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "" }
|
||||
|
||||
#include "dtor4.h"
|
||||
|
||||
S s;
|
13
gcc/testsuite/g++.dg/opt/dtor4.C
Normal file
13
gcc/testsuite/g++.dg/opt/dtor4.C
Normal file
@ -0,0 +1,13 @@
|
||||
// PR tree-optimization/42625
|
||||
// { dg-do run }
|
||||
// { dg-options "-O1 -fipa-sra" }
|
||||
// { dg-additional-sources "dtor4-aux.cc" }
|
||||
|
||||
#include "dtor4.h"
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
S s;
|
||||
return 0;
|
||||
}
|
8
gcc/testsuite/g++.dg/opt/dtor4.h
Normal file
8
gcc/testsuite/g++.dg/opt/dtor4.h
Normal file
@ -0,0 +1,8 @@
|
||||
#include <cassert>
|
||||
|
||||
struct S
|
||||
{
|
||||
int a, i;
|
||||
S () : i(1) {}
|
||||
__attribute__((noinline)) ~S () { assert (i == 1); }
|
||||
};
|
Loading…
Reference in New Issue
Block a user