Message ID | 20100629185445.GQ25077@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
On Tue, Jun 29, 2010 at 14:54, Jakub Jelinek <jakub@redhat.com> wrote: > 2010-06-29 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/43801 > * cgraph.c (cgraph_create_virtual_clone): Clear DECL_SECTION_NAME > if old_decl was DECL_ONE_ONLY. > > * g++.dg/torture/pr43801.C: New test. OK. Diego.
> Hi! > > When a fndecl is DECL_ONE_ONLY and has DECL_SECTION_NAME already set (e.g. > because of emitting associated thunks), its virtual clones which are not > DECL_ONE_ONLY definitely must not reuse its section, because that results in > section conflicts. For non-comdat functions e.g. put by user into some > special section I think we can just reuse that section. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for > trunk? > > 2010-06-29 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/43801 > * cgraph.c (cgraph_create_virtual_clone): Clear DECL_SECTION_NAME > if old_decl was DECL_ONE_ONLY. Don't we want to do this in make_decl_local? Honza
On Wed, Jun 30, 2010 at 04:12:55AM +0200, Jan Hubicka wrote: > > When a fndecl is DECL_ONE_ONLY and has DECL_SECTION_NAME already set (e.g. > > because of emitting associated thunks), its virtual clones which are not > > DECL_ONE_ONLY definitely must not reuse its section, because that results in > > section conflicts. For non-comdat functions e.g. put by user into some > > special section I think we can just reuse that section. > > > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for > > trunk? > > > > 2010-06-29 Jakub Jelinek <jakub@redhat.com> > > > > PR tree-optimization/43801 > > * cgraph.c (cgraph_create_virtual_clone): Clear DECL_SECTION_NAME > > if old_decl was DECL_ONE_ONLY. > > Don't we want to do this in make_decl_local? make_decl_local doesn't work on a copy, so if DECL_SECTION_NAME has been assigned for it, I'd say it is too late to try to make it !DECL_ONE_ONLY (e.g. associated thunks had to be emitted). But perhaps it won't hurt to do that anyway. Jakub
> On Wed, Jun 30, 2010 at 04:12:55AM +0200, Jan Hubicka wrote: > > > When a fndecl is DECL_ONE_ONLY and has DECL_SECTION_NAME already set (e.g. > > > because of emitting associated thunks), its virtual clones which are not > > > DECL_ONE_ONLY definitely must not reuse its section, because that results in > > > section conflicts. For non-comdat functions e.g. put by user into some > > > special section I think we can just reuse that section. > > > > > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for > > > trunk? > > > > > > 2010-06-29 Jakub Jelinek <jakub@redhat.com> > > > > > > PR tree-optimization/43801 > > > * cgraph.c (cgraph_create_virtual_clone): Clear DECL_SECTION_NAME > > > if old_decl was DECL_ONE_ONLY. > > > > Don't we want to do this in make_decl_local? > > make_decl_local doesn't work on a copy, so if DECL_SECTION_NAME has been > assigned for it, I'd say it is too late to try to make it !DECL_ONE_ONLY > (e.g. associated thunks had to be emitted). > But perhaps it won't hurt to do that anyway. It is given a copy via cgraph_function_versioning Honza > > Jakub
--- gcc/cgraph.c.jj 2010-06-28 15:36:30.000000000 +0200 +++ gcc/cgraph.c 2010-06-29 18:05:36.000000000 +0200 @@ -2217,6 +2217,8 @@ cgraph_create_virtual_clone (struct cgra ??? We cannot use COMDAT linkage because there is no ABI support for this. */ DECL_EXTERNAL (new_node->decl) = 0; + if (DECL_ONE_ONLY (old_decl)) + DECL_SECTION_NAME (new_node->decl) = NULL; DECL_COMDAT_GROUP (new_node->decl) = 0; TREE_PUBLIC (new_node->decl) = 0; DECL_COMDAT (new_node->decl) = 0; --- gcc/testsuite/g++.dg/torture/pr43801.C.jj 2010-06-29 18:09:32.000000000 +0200 +++ gcc/testsuite/g++.dg/torture/pr43801.C 2010-06-29 18:10:34.000000000 +0200 @@ -0,0 +1,22 @@ +// PR tree-optimization/43801 +// { dg-do compile } +// { dg-options "-fipa-cp -fipa-cp-clone" } + +struct A +{ + virtual void f (int); +}; +struct B : virtual A +{ + virtual void f (int i) { if (i) A::f(0); } +}; +struct C : virtual B +{ + virtual void f (int) { B::f(0); } +}; + +void +foo () +{ + C (); +}