Message ID | 20150217204743.GB1746@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
> Hi! > > Markus reported an ICE, that is fixed by following patch, which limits > the earlier change to !implicit_section only (which I assume is the user > supplied __attribute__((section ()))). > > Bootstrapped/regtested on {x86_64,i686,aarch64,ppc64,ppc64le,s390,s390x}-linux. > Ok for trunk? > > 2015-02-17 Jakub Jelinek <jakub@redhat.com> > > PR ipa/65087 > * cgraphclones.c (cgraph_node::create_virtual_clone): Only copy > section if !implicit_section. > (cgraph_node::create_version_clone_with_body): Likewise. > * trans-mem.c (ipa_tm_create_version): Likewise. This seems OK. I wonder what the bug Markus reported is. Can you, please, double check that with -ffunction-sections the clones will be eventually run across resolve_unique_section and not say in the anonymous one? Honza
On 2015.02.17 at 22:00 +0100, Jan Hubicka wrote: > > Hi! > > > > Markus reported an ICE, that is fixed by following patch, which limits > > the earlier change to !implicit_section only (which I assume is the user > > supplied __attribute__((section ()))). > > > > Bootstrapped/regtested on {x86_64,i686,aarch64,ppc64,ppc64le,s390,s390x}-linux. > > Ok for trunk? > > > > 2015-02-17 Jakub Jelinek <jakub@redhat.com> > > > > PR ipa/65087 > > * cgraphclones.c (cgraph_node::create_virtual_clone): Only copy > > section if !implicit_section. > > (cgraph_node::create_version_clone_with_body): Likewise. > > * trans-mem.c (ipa_tm_create_version): Likewise. > > This seems OK. I wonder what the bug Markus reported is. The ICE only happens with -fdevirtualize-at-ltrans: trippels@gcc2-power8 library % g++ -flto -fdevirtualize-at-ltrans -shared @list lto1: internal compiler error: in ipcp_verify_propagated_values, at ipa-cp.c:1057 0x10d1270f ipcp_verify_propagated_values() ../../gcc/gcc/ipa-cp.c:1057 0x10d1481b ipcp_propagate_stage ../../gcc/gcc/ipa-cp.c:2758 0x10d1481b ipcp_driver ../../gcc/gcc/ipa-cp.c:4416 0x10d1481b execute ../../gcc/gcc/ipa-cp.c:4511 I will try to come up with a testcase.
> On 2015.02.17 at 22:00 +0100, Jan Hubicka wrote: > > > Hi! > > > > > > Markus reported an ICE, that is fixed by following patch, which limits > > > the earlier change to !implicit_section only (which I assume is the user > > > supplied __attribute__((section ()))). > > > > > > Bootstrapped/regtested on {x86_64,i686,aarch64,ppc64,ppc64le,s390,s390x}-linux. > > > Ok for trunk? > > > > > > 2015-02-17 Jakub Jelinek <jakub@redhat.com> > > > > > > PR ipa/65087 > > > * cgraphclones.c (cgraph_node::create_virtual_clone): Only copy > > > section if !implicit_section. > > > (cgraph_node::create_version_clone_with_body): Likewise. > > > * trans-mem.c (ipa_tm_create_version): Likewise. > > > > This seems OK. I wonder what the bug Markus reported is. > > The ICE only happens with -fdevirtualize-at-ltrans: > > trippels@gcc2-power8 library % g++ -flto -fdevirtualize-at-ltrans -shared @list > lto1: internal compiler error: in ipcp_verify_propagated_values, at ipa-cp.c:1057 > 0x10d1270f ipcp_verify_propagated_values() > ../../gcc/gcc/ipa-cp.c:1057 > 0x10d1481b ipcp_propagate_stage > ../../gcc/gcc/ipa-cp.c:2758 > 0x10d1481b ipcp_driver > ../../gcc/gcc/ipa-cp.c:4416 > 0x10d1481b execute > ../../gcc/gcc/ipa-cp.c:4511 > > I will try to come up with a testcase. This is interesting indeed. -fdevirtualize-at-ltrans should not change outcome of ipa-cp, so we defintly have some latent bug here. Testcase would be great. Honza > > -- > Markus
On 2015.02.18 at 10:17 +0100, Jan Hubicka wrote: > > On 2015.02.17 at 22:00 +0100, Jan Hubicka wrote: > > > > Hi! > > > > > > > > Markus reported an ICE, that is fixed by following patch, which limits > > > > the earlier change to !implicit_section only (which I assume is the user > > > > supplied __attribute__((section ()))). > > > > > > > > Bootstrapped/regtested on {x86_64,i686,aarch64,ppc64,ppc64le,s390,s390x}-linux. > > > > Ok for trunk? > > > > > > > > 2015-02-17 Jakub Jelinek <jakub@redhat.com> > > > > > > > > PR ipa/65087 > > > > * cgraphclones.c (cgraph_node::create_virtual_clone): Only copy > > > > section if !implicit_section. > > > > (cgraph_node::create_version_clone_with_body): Likewise. > > > > * trans-mem.c (ipa_tm_create_version): Likewise. > > > > > > This seems OK. I wonder what the bug Markus reported is. > > > > The ICE only happens with -fdevirtualize-at-ltrans: > > > > trippels@gcc2-power8 library % g++ -flto -fdevirtualize-at-ltrans -shared @list > > lto1: internal compiler error: in ipcp_verify_propagated_values, at ipa-cp.c:1057 > > 0x10d1270f ipcp_verify_propagated_values() > > ../../gcc/gcc/ipa-cp.c:1057 > > 0x10d1481b ipcp_propagate_stage > > ../../gcc/gcc/ipa-cp.c:2758 > > 0x10d1481b ipcp_driver > > ../../gcc/gcc/ipa-cp.c:4416 > > 0x10d1481b execute > > ../../gcc/gcc/ipa-cp.c:4511 > > > > I will try to come up with a testcase. > > This is interesting indeed. -fdevirtualize-at-ltrans should not change outcome of ipa-cp, > so we defintly have some latent bug here. Testcase would be great. -fno-ipa-icf also fixes the issue: (You of course need a revision before Jakub's r220786 fix in order to reproduce) 1) trippels@gcc20 testcase % cat test.ii class A { virtual int m_fn1(); }; class B { public: virtual int m_fn2(); int m_fn3(); }; class C { virtual void m_fn4(int *, B *, bool); }; class D : A, C { void m_fn4(int *, B *, bool); void m_fn5(int *, B *, bool); }; void D::m_fn4(int *, B *p2, bool) { p2->m_fn3() && p2->m_fn2(); } void D::m_fn5(int *, B *p2, bool) { p2->m_fn3() && p2->m_fn2(); } trippels@gcc20 testcase % ~/gcc_test/usr/local/bin/g++ -r -nostdlib -flto -ffunction-sections -O2 test.ii lto1: internal compiler error: in ipcp_verify_propagated_values, at ipa-cp.c:1057 2) trippels@gcc20 testcase % cat Unified_cpp_editor_txmgr0.ii typedef enum { } nsresult; class nsISupports { public: virtual nsresult m_fn1 (); virtual int m_fn2 (); virtual int m_fn3 (); }; class A { public: A (); }; class nsCOMPtr_base { public: ~nsCOMPtr_base () { mRawPtr->m_fn3 (); } nsISupports *mRawPtr; }; class C : nsCOMPtr_base { public: C (int); }; class B { C mTransaction; B (); A _mOwningThread; }; B::B () : mTransaction (0) {} trippels@gcc20 testcase % cat Unified_cpp_layout_base2.ii #pragma GCC visibility push(hidden) class A { virtual int m_fn1(); }; class B { public: virtual bool m_fn2(); bool m_fn3(); }; #pragma GCC visibility pop class C { virtual void m_fn4(int *, B *, bool); }; class D : A, C { void m_fn4(int *, B *, bool); virtual void m_fn5(int *, B *, bool); }; void D::m_fn4(int *, B *p2, bool) { if (p2->m_fn3() && p2->m_fn2()) { } } void D::m_fn5(int *, B *p2, bool) { if (p2->m_fn3() && p2->m_fn2()) { } } trippels@gcc20 testcase % ~/gcc_test/usr/local/bin/g++ -w -r -nostdlib -flto -fdevirtualize-at-ltrans -ffunction-sections -O2 Unified_cpp_editor_txmgr0.ii Unified_cpp_layout_base2.ii lto1: internal compiler error: in ipcp_verify_propagated_values, at ipa-cp.c:1057 trippels@gcc20 testcase % ~/gcc_test/usr/local/bin/g++ -w -r -nostdlib -fno-ipa-icf -flto -fdevirtualize-at-ltrans -ffunction-sections -O2 Unified_cpp_editor_txmgr0.ii Unified_cpp_layout_base2.ii trippels@gcc20 testcase % ~/gcc_test/usr/local/bin/g++ -w -r -nostdlib -flto -ffunction-sections -O2 Unified_cpp_editor_txmgr0.ii Unified_cpp_layout_base2.ii trippels@gcc20 testcase %
--- gcc/cgraphclones.c.jj 2015-02-16 20:16:43.000000000 +0100 +++ gcc/cgraphclones.c 2015-02-17 09:35:19.682184215 +0100 @@ -617,7 +617,7 @@ cgraph_node::create_virtual_clone (vec<c ABI support for this. */ set_new_clone_decl_and_node_flags (new_node); new_node->clone.tree_map = tree_map; - if (!DECL_ONE_ONLY (old_decl)) + if (!implicit_section) new_node->set_section (get_section ()); /* Clones of global symbols or symbols with unique names are unique. */ @@ -1011,7 +1011,8 @@ cgraph_node::create_version_clone_with_b new_version_node->externally_visible = 0; new_version_node->local.local = 1; new_version_node->lowered = true; - new_version_node->set_section (get_section ()); + if (!implicit_section) + new_version_node->set_section (get_section ()); /* Clones of global symbols or symbols with unique names are unique. */ if ((TREE_PUBLIC (old_decl) && !DECL_EXTERNAL (old_decl) --- gcc/trans-mem.c.jj 2015-02-16 20:16:43.000000000 +0100 +++ gcc/trans-mem.c 2015-02-17 09:35:19.682184215 +0100 @@ -4967,7 +4967,8 @@ ipa_tm_create_version (struct cgraph_nod new_node->externally_visible = old_node->externally_visible; new_node->lowered = true; new_node->tm_clone = 1; - new_node->set_section (old_node->get_section ()); + if (!old_node->implicit_section) + new_node->set_section (old_node->get_section ()); get_cg_data (&old_node, true)->clone = new_node; if (old_node->get_availability () >= AVAIL_INTERPOSABLE)