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]

Re: [PATCH] Use !implicit_section in the recent set_section change (PR ipa/65087)


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 %    
-- 
Markus


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