[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-19 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

--- Comment #7 from prathamesh3492 at gcc dot gnu.org ---
(In reply to Jan Hubicka from comment #5)
> The problem seems to be that cgraph_node::get_untransformed_body checks
> presence of body by DECL_RESULT which is NULL for thunks. Rest of places
> seems to check for DECL_ARGUMENTS.
Thanks for pointing out. I was wondering why this ICE'd only
with -flto-partition=none and not with other partitioning methods ? For the
test-case, with partitioning enabled, get_untransformed_body () was called only
once per node.
Or is this issue irrelevant to partitioning ?

Thanks,
Prathamesh
> 
> I am testing:
> Index: cgraph.c
> ===
> --- cgraph.c(revision 232466)
> +++ cgraph.c(working copy)
> @@ -3305,10 +3295,11 @@ cgraph_node::get_untransformed_body (voi
>size_t len;
>tree decl = this->decl;
>  
> -  if (DECL_RESULT (decl))
> +  /* Check if body is already there.  */
> +  if (!DECL_ARGUMENTS (decl))
>  return false;
>  
> -  gcc_assert (in_lto_p);
> +  gcc_assert (in_lto_p && !DECL_RESULT (decl))
>  
>timevar_push (TV_IPA_LTO_GIMPLE_IN);

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-19 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

--- Comment #8 from Jan Hubicka  ---
Well, -flto-partition=none does bot IPA optimization and codegen in one run. In
this case the body was once read by ipa-cp to duplicate the thunk and second
time by expand_thunk.  With other methods the streaming happened in between
that hides the problem.

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-19 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

--- Comment #9 from Jan Hubicka  ---
Author: hubicka
Date: Tue Jan 19 11:57:41 2016
New Revision: 232552

URL: https://gcc.gnu.org/viewcvs?rev=232552=gcc=rev
Log:

PR lto/69133
* cgraphunit.c (cgraph_node::expand_thunk): When forcing gimple
assume that the node has body.
* cgraph.c (cgraph_node::get_untransformed_body): Use gimple_body_p
check.
* g++.dg/lto/pr69133_0.C: New testcase.
* g++.dg/lto/pr69133_1.C: New testcase.

Added:
trunk/gcc/testsuite/g++.dg/lto/pr69133_0.C
trunk/gcc/testsuite/g++.dg/lto/pr69133_1.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraph.c
trunk/gcc/cgraphunit.c
trunk/gcc/testsuite/ChangeLog

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-19 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

Jan Hubicka  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Jan Hubicka  ---
Fixed.

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-18 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

Jan Hubicka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-18 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

--- Comment #5 from Jan Hubicka  ---
The problem seems to be that cgraph_node::get_untransformed_body checks
presence of body by DECL_RESULT which is NULL for thunks. Rest of places seems
to check for DECL_ARGUMENTS.

I am testing:
Index: cgraph.c
===
--- cgraph.c(revision 232466)
+++ cgraph.c(working copy)
@@ -3305,10 +3295,11 @@ cgraph_node::get_untransformed_body (voi
   size_t len;
   tree decl = this->decl;

-  if (DECL_RESULT (decl))
+  /* Check if body is already there.  */
+  if (!DECL_ARGUMENTS (decl))
 return false;

-  gcc_assert (in_lto_p);
+  gcc_assert (in_lto_p && !DECL_RESULT (decl))

   timevar_push (TV_IPA_LTO_GIMPLE_IN);

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-18 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

--- Comment #6 from Jan Hubicka  ---
The following has even chance to work :)

Index: cgraph.c
===
--- cgraph.c(revision 232466)
+++ cgraph.c(working copy)
@@ -3305,10 +3295,12 @@ cgraph_node::get_untransformed_body (voi
   size_t len;
   tree decl = this->decl;

-  if (DECL_RESULT (decl))
+  /* Check if body is already there.  Either we have gimple body or
+ the function is thunk and in that case we set DECL_ARGUMENTS.  */
+  if (DECL_ARGUMENTS (decl) || gimple_has_body_p (decl))
 return false;

-  gcc_assert (in_lto_p);
+  gcc_assert (in_lto_p && !DECL_RESULT (decl));

   timevar_push (TV_IPA_LTO_GIMPLE_IN);

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-05 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

Markus Trippelsdorf  changed:

   What|Removed |Added

   Keywords|ice-on-valid-code   |ice-on-invalid-code

--- Comment #4 from Markus Trippelsdorf  ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Markus Trippelsdorf from comment #2)
> 
> The code included here is undefined due to ODR violations.

Yes, that is why I used "ice-on-invalid-code" keyword, that you wrongly
changed.

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

Andrew Pinski  changed:

   What|Removed |Added

   Keywords|ice-on-invalid-code |ice-on-valid-code
   Target Milestone|--- |6.0

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-05 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

--- Comment #3 from Andrew Pinski  ---
(In reply to Markus Trippelsdorf from comment #2)

The code included here is undefined due to ODR violations.

[Bug lto/69133] [6 Regression] LTO segfault in lto_get_decl_name_mapping() on 483.xalancbmk with -flto-partition=none

2016-01-04 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69133

Markus Trippelsdorf  changed:

   What|Removed |Added

 Target|x86_64-unknown-linux-gnu|
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-04
 CC||hubicka at ucw dot cz
   Host|x86_64-unknown-linux-gnu|
Summary|LTO segfault in |[6 Regression] LTO segfault
   |lto_get_decl_name_mapping() |in
   |on 483.xalancbmk with   |lto_get_decl_name_mapping()
   |-flto-partitions=none   |on 483.xalancbmk with
   ||-flto-partition=none
 Ever confirmed|0   |1
  Build|x86_64-unknown-linux-gnu|

--- Comment #2 from Markus Trippelsdorf  ---
markus@x4 tmp % cat DTDScanner.ii
namespace xercesc_3_1 {
class XMLEntityHandler {
public:
  virtual ~XMLEntityHandler();
  virtual void m_fn1();
  virtual bool m_fn2();
  virtual void m_fn3();
  virtual int m_fn4();
  virtual void m_fn5();
} * a;
void fn1() {
  a->m_fn5();
  a->m_fn1();
}
}

markus@x4 tmp % cat XSDDOMParser.ii
namespace xercesc_3_1 {
class A {
  virtual void m_fn1();
};
class XMLEntityHandler {
public:
  virtual ~XMLEntityHandler();
  virtual void m_fn2(const int &);
  virtual bool m_fn3();
  virtual void m_fn4();
  virtual int m_fn5() = 0;
  virtual void m_fn6(const int &);
};
class B : A, XMLEntityHandler {};
class C : B {
  void m_fn2(const int &);
  void m_fn6(const int &);
};
void C::m_fn2(const int &) {}
void C::m_fn6(const int &) {}
}

markus@x4 tmp % g++ -r -nostdlib -flto -flto-partition=none -O2 DTDScanner.ii
XSDDOMParser.ii
lto1: internal compiler error: Segmentation fault
0xa09bef crash_signal
../../gcc/gcc/toplev.c:334
0x7fbffe8ed30f ???
   
/home/markus/glibc/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x8d4b48 lto_get_decl_name_mapping(lto_file_decl_data*, char const*)
../../gcc/gcc/lto-section-in.c:352
0x655eeb cgraph_node::get_untransformed_body()
../../gcc/gcc/cgraph.c:3319
...