public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
@ 2011-11-07 19:50 zsojka at seznam dot cz
  2011-11-08 10:37 ` [Bug tree-optimization/51012] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2011-11-07 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51012
           Summary: [4.7 Regression] ICE: in fold_convert_loc, at
                    fold-const.c:1897 with -fno-early-inlining and passing
                    incompatible function ptr
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz
                CC: rguenth@gcc.gnu.org
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 25742
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25742
reduced testcase

This is very similiar to PR50890, actually the testcase was reduced from
testsuite/gcc.dg/torture/pr50890.c

Compiler output:
$ gcc -O2 -fno-early-inlining testcase.c 
testcase.c: In function 'foo':
testcase.c:9:3: internal compiler error: in fold_convert_loc, at
fold-const.c:1897
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

(gdb) bt
#0  fancy_abort (file=0x122c488 "/mnt/svn/gcc-trunk/gcc/fold-const.c",
line=1894, function=0x122b500 "fold_convert_loc")
    at /mnt/svn/gcc-trunk/gcc/diagnostic.c:898
#1  0x00000000007a602b in fold_convert_loc (loc=0, type=0x7ffff55915e8,
arg=Unhandled dwarf expression opcode 0xf3
) at /mnt/svn/gcc-trunk/gcc/fold-const.c:1893
#2  0x0000000000a09879 in declare_return_variable (fn=0x7ffff56a1200) at
/mnt/svn/gcc-trunk/gcc/tree-inline.c:2909
#3  expand_call_inline (fn=0x7ffff56a1200) at
/mnt/svn/gcc-trunk/gcc/tree-inline.c:3927
#4  gimple_expand_calls_inline (fn=0x7ffff56a1200) at
/mnt/svn/gcc-trunk/gcc/tree-inline.c:4058
#5  optimize_inline_calls (fn=0x7ffff56a1200) at
/mnt/svn/gcc-trunk/gcc/tree-inline.c:4218
#6  0x0000000001103cab in inline_transform (node=0x7ffff5588900) at
/mnt/svn/gcc-trunk/gcc/ipa-inline-transform.c:369
#7  0x00000000008d4531 in execute_one_ipa_transform_pass () at
/mnt/svn/gcc-trunk/gcc/passes.c:1912
#8  execute_all_ipa_transforms () at /mnt/svn/gcc-trunk/gcc/passes.c:1947
#9  0x0000000000a29aa5 in tree_rest_of_compilation (fndecl=0x7ffff56a1200) at
/mnt/svn/gcc-trunk/gcc/tree-optimize.c:413
#10 0x000000000068d13a in cgraph_expand_function (node=0x7ffff5588900) at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1819
#11 0x000000000068f0bc in cgraph_expand_all_functions () at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1886
#12 cgraph_optimize () at /mnt/svn/gcc-trunk/gcc/cgraphunit.c:2197
#13 0x000000000068f5ba in cgraph_finalize_compilation_unit () at
/mnt/svn/gcc-trunk/gcc/cgraphunit.c:1327
#14 0x000000000057575b in c_write_global_declarations () at
/mnt/svn/gcc-trunk/gcc/c-decl.c:9940
#15 0x00000000009c8984 in compile_file (argc=14, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:581
#16 do_compile (argc=14, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1930
#17 toplev_main (argc=14, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:2006
#18 0x00007ffff6178d2d in __libc_start_main () from /lib64/libc.so.6
#19 0x0000000000559339 in _start ()


Tested revisions:
r181026 - crash
r178498 - crash
4.6 r180325 - OK


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
  2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
@ 2011-11-08 10:37 ` rguenth at gcc dot gnu.org
  2011-11-08 13:07 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-08 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-11-08
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.7.0
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-08 10:37:01 UTC ---
Mine.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
  2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
  2011-11-08 10:37 ` [Bug tree-optimization/51012] " rguenth at gcc dot gnu.org
@ 2011-11-08 13:07 ` rguenth at gcc dot gnu.org
  2011-11-08 13:25 ` jamborm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-08 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-08 12:55:53 UTC ---
With -fno-ipa-cp it is indirect inlining that performs the bogus inline.
Fixed (for non-WPA only?) by

Index: gcc/ipa-prop.c
===================================================================
--- gcc/ipa-prop.c      (revision 181154)
+++ gcc/ipa-prop.c      (working copy)
@@ -1905,6 +1905,13 @@ update_indirect_edges_after_inlining (st
       if (new_direct_edge)
        {
          new_direct_edge->indirect_inlining_edge = 1;
+         if (new_direct_edge->call_stmt
+             && !gimple_check_call_matching_types (new_direct_edge->call_stmt,
+                                                  
new_direct_edge->callee->decl))
+           {
+             gimple_call_set_cannot_inline (new_direct_edge->call_stmt, true);
+             new_direct_edge->call_stmt_cannot_inline_p = true;
+           }
          if (new_edges)
            {
              VEC_safe_push (cgraph_edge_p, heap, *new_edges,

With -fipa-cp not disabled we still ICE, but we can fixup in
cgraph_make_edge_direct (how many copies of such code remain?)

Index: gcc/cgraph.c
===================================================================
--- gcc/cgraph.c        (revision 181154)
+++ gcc/cgraph.c        (working copy)
@@ -1184,6 +1184,13 @@ cgraph_make_edge_direct (struct cgraph_e
   /* Insert to callers list of the new callee.  */
   cgraph_set_edge_callee (edge, callee);

+  if (edge->call_stmt
+      && !gimple_check_call_matching_types (edge->call_stmt, callee->decl))
+    {
+      gimple_call_set_cannot_inline (edge->call_stmt, true);
+      edge->call_stmt_cannot_inline_p = true;
+    }
+
   /* We need to re-determine the inlining status of the edge.  */
   initialize_inline_failed (edge);
 }

What about WPA stage?  I think we don't "fixup" inlinable status of
edges at the beginning of ltrans (or inline transform).  Do we?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
  2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
  2011-11-08 10:37 ` [Bug tree-optimization/51012] " rguenth at gcc dot gnu.org
  2011-11-08 13:07 ` rguenth at gcc dot gnu.org
@ 2011-11-08 13:25 ` jamborm at gcc dot gnu.org
  2011-11-08 14:18 ` rguenther at suse dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jamborm at gcc dot gnu.org @ 2011-11-08 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> 2011-11-08 13:06:29 UTC ---
(In reply to comment #2)
> 
> What about WPA stage?  I think we don't "fixup" inlinable status of
> edges at the beginning of ltrans (or inline transform).  Do we?

No.  And unless this got addressed meanwhile, we don't need indirect
inlining to hit this bug with LTO (I belive
https://bugzilla.mozilla.org/show_bug.cgi?id=652563 is a manifestation
of this problem).  IIRC, Honza had plausible reasons why un-doing
inlining decisions is tough but we eventually either need that or
store types of arguments along each call graph edge.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
  2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2011-11-08 13:25 ` jamborm at gcc dot gnu.org
@ 2011-11-08 14:18 ` rguenther at suse dot de
  2011-11-08 15:19 ` rguenth at gcc dot gnu.org
  2011-11-08 15:44 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenther at suse dot de @ 2011-11-08 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> 2011-11-08 13:50:44 UTC ---
On Tue, 8 Nov 2011, jamborm at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51012
> 
> --- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> 2011-11-08 13:06:29 UTC ---
> (In reply to comment #2)
> > 
> > What about WPA stage?  I think we don't "fixup" inlinable status of
> > edges at the beginning of ltrans (or inline transform).  Do we?
> 
> No.  And unless this got addressed meanwhile, we don't need indirect
> inlining to hit this bug with LTO (I belive
> https://bugzilla.mozilla.org/show_bug.cgi?id=652563 is a manifestation
> of this problem).  IIRC, Honza had plausible reasons why un-doing
> inlining decisions is tough but we eventually either need that or
> store types of arguments along each call graph edge.

I understand its 'though' because we possibly have thrown away
the offline copy already before committing inline decisions?
But - can't we simply materialize the clone?  (of course that
would be possibly many clones...)

Note that with LTO symbol merging even direct calls may become
un-inlinable (because they change to an incompatible signature).

Note that the idea to _not_ inline in those cases is motivated
to behave exactly the same as if we'd not inline for such
undefined code.  We could certainly fix this up during inlining
itself - as last resort with going through a memory temporary
(ugh).  But we for sure will behave differently than the target
machine for simple integer mode mismatches (note that what we see
on gimple doesn't really reflect the target ABI or what we would
see on RTL ...)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
  2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2011-11-08 14:18 ` rguenther at suse dot de
@ 2011-11-08 15:19 ` rguenth at gcc dot gnu.org
  2011-11-08 15:44 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-08 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-08 15:16:28 UTC ---
Author: rguenth
Date: Tue Nov  8 15:16:22 2011
New Revision: 181166

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181166
Log:
2011-11-08  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/51012
    * ipa-prop.c (update_indirect_edges_after_inlining): Fixup
    non-inlinable state.
    * cgraph.c (cgraph_make_edge_direct): Likewise.

    * gcc.dg/pr51012-1.c: New testcase.
    * gcc.dg/pr51012-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/pr51012-1.c
    trunk/gcc/testsuite/gcc.dg/pr51012-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/gcc/ipa-prop.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/51012] [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr
  2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2011-11-08 15:19 ` rguenth at gcc dot gnu.org
@ 2011-11-08 15:44 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-08 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-08 15:19:31 UTC ---
Fixed.  Well, in this incarnation at least ;)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-11-08 15:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-07 19:50 [Bug tree-optimization/51012] New: [4.7 Regression] ICE: in fold_convert_loc, at fold-const.c:1897 with -fno-early-inlining and passing incompatible function ptr zsojka at seznam dot cz
2011-11-08 10:37 ` [Bug tree-optimization/51012] " rguenth at gcc dot gnu.org
2011-11-08 13:07 ` rguenth at gcc dot gnu.org
2011-11-08 13:25 ` jamborm at gcc dot gnu.org
2011-11-08 14:18 ` rguenther at suse dot de
2011-11-08 15:19 ` rguenth at gcc dot gnu.org
2011-11-08 15:44 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).