[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-05-19 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2010-05-19 13:16 ---
Subject: Bug 43455

Author: rguenth
Date: Wed May 19 13:14:37 2010
New Revision: 159564

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159564
Log:
2010-05-19  Richard Guenther  

Backport from mainline:
2010-04-26  Richard Guenther  

PR lto/43455
* tree-inline.c (tree_can_inline_p): Also check compatibility
of return types.

* gcc.dg/lto/20100423-1_0.c: New testcase.
* gcc.dg/lto/20100423-1_1.c: Likewise.

2010-04-23  Richard Guenther  

PR lto/42653
* tree.c (free_lang_data_in_decl): Do not reset DECL_CONTEXT
of FUNCTION_DECLs.

* g++.dg/lto/20100423-1_0.C: New testcase.

2010-04-26  Richard Guenther  

PR lto/42425
* tree.c (free_lang_data_in_type): Do not free TYPE_CONTEXT
if emitting debug information and it is either a function
or a namespace decl.

* g++.dg/lto/20100423-2_0.C: New testcase.

2010-04-26  Richard Guenther  

PR lto/43080
* gimple.c (gimple_decl_printable_name): Deal gracefully
with a NULL DECL_NAME.

* g++.dg/lto/20100423-3_0.C: New testcase.

2010-04-30  Richard Guenther  

PR lto/43946
* passes.c (init_optimization_passes): Move pass_ipa_free_lang_data
first after all lowering passes.

* gcc.dg/lto/20100430-1_0.c: New testcase.

Added:
branches/gcc-4_5-branch/gcc/testsuite/g++.dg/lto/20100423-1_0.C
branches/gcc-4_5-branch/gcc/testsuite/g++.dg/lto/20100423-2_0.C
branches/gcc-4_5-branch/gcc/testsuite/g++.dg/lto/20100423-3_0.C
branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/lto/20100423-1_0.c
branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/lto/20100423-1_1.c
branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/lto/20100430-1_0.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/gimple.c
branches/gcc-4_5-branch/gcc/passes.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
branches/gcc-4_5-branch/gcc/tree-inline.c
branches/gcc-4_5-branch/gcc/tree.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455



[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-05-19 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Target Milestone|4.6.0   |4.5.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455



[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-04-23 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2010-04-23 15:18 ---
Subject: Bug 43455

Author: rguenth
Date: Fri Apr 23 15:18:24 2010
New Revision: 158669

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158669
Log:
2010-04-23  Richard Guenther  

PR lto/43455
* tree-inline.c (tree_can_inline_p): Also check compatibility
of return types.

* gcc.dg/lto/20100423-1_0.c: New testcase.
* gcc.dg/lto/20100423-1_1.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.dg/lto/20100423-1_0.c
trunk/gcc/testsuite/gcc.dg/lto/20100423-1_1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-inline.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455



[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-04-23 Thread rguenth at gcc dot gnu dot org


--- Comment #5 from rguenth at gcc dot gnu dot org  2010-04-23 15:18 ---
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to fail||4.5.0
 Resolution||FIXED
   Target Milestone|--- |4.6.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455



[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-04-23 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2010-04-23 13:39 ---
I am testing a patch to tree_can_inline_p instead.  That doesn't work with
WPA as we do not have the call_stmt available there - Honza, any idea where
to re-apply the check?


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu dot
   ||org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455



[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-03-22 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2010-03-22 10:30:26 |2010-03-22 10:30:41
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455



[Bug lto/43455] ICE in fold_convert_loc, at fold-const.c:2670 with -O2 -flto

2010-03-22 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2010-03-22 10:30 ---
I get on x86_64-linux

> ./xgcc -B. -flto t1.c t2.c -O2
In file included from t2.c:2:0,
 from t1.c:2,
 from :0:
t1.c: In function 'main':
t1.c:5:22: internal compiler error: in fold_convert_loc, at fold-const.c:2792
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
lto-wrapper: ././xgcc returned 1 exit status
collect2: lto-wrapper returned 1 exit status

same with the less reduced testcase on x86_64 and i?86 linux.

Thanks for the report.


This is because we do not merge

  struct bar {int x;};

and

  typedef struct{int x;} bar;

but we expect to be able to convert them into each other during inlining:

#2  0x00c120ac in declare_return_variable (id=0x7fffd9d0, 
return_slot=0x0, modify_dest=0x75af03c0)
at /space/rguenther/src/svn/trunk/gcc/tree-inline.c:2690
2690use = fold_convert (caller_type, var);
(gdb) l
2685
2686  /* Build the use expr.  If the return type of the function was
2687 promoted, convert it back to the expected type.  */
2688  use = var;
2689  if (!useless_type_conversion_p (caller_type, TREE_TYPE (var)))
2690use = fold_convert (caller_type, var);


This is really invalid C as bar is re-declared in an incompatible way
(which you'd see if you combine both TUs).

Now, we shouldn't ICE here anyway and LTO should be forgiving to this
kind of errors.

The following fixes the symptoms.

Index: gcc/tree-inline.c
===
--- gcc/tree-inline.c   (revision 157619)
+++ gcc/tree-inline.c   (working copy)
@@ -2687,7 +2687,12 @@ declare_return_variable (copy_body_data
  promoted, convert it back to the expected type.  */
   use = var;
   if (!useless_type_conversion_p (caller_type, TREE_TYPE (var)))
-use = fold_convert (caller_type, var);
+{
+  if (fold_convertible_p (caller_type, var))
+   use = fold_convert (caller_type, var);
+  else
+   use = fold_build1 (VIEW_CONVERT_EXPR, caller_type, var);
+}

   STRIP_USELESS_TYPE_CONVERSION (use);


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2010-03-22 10:30:26
   date||
Summary|Compiler hang with -O2 -flto|ICE in fold_convert_loc, at
   ||fold-const.c:2670 with -O2 -
   ||flto


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43455