public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894
@ 2011-10-27 21:54 belyshev at depni dot sinp.msu.ru
  2011-10-28  9:45 ` [Bug middle-end/50890] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: belyshev at depni dot sinp.msu.ru @ 2011-10-27 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50890
           Summary: [4.7 Regression] ICE in fold_convert_loc, at
                    fold-const.c:1894
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: belyshev@depni.sinp.msu.ru
                CC: hubicka@gcc.gnu.org


r172609
(http://gcc.gnu.org/viewcvs?limit_changes=0&view=revision&revision=172609)
caused ICE with -O2 or -O1 -finline-small-functions on this (invalid?)
testcase, note function pointer type cast:

static float make_insn_raw (void)
{
  return 0;
}

static int emit_pattern_after_noloc (int (make_raw) ()) 
{
  return make_raw ();
}

void emit_insn_after_noloc (void) 
{
  emit_pattern_after_noloc ((void *) make_insn_raw);
}

bug.c:8:3: internal compiler error: in fold_convert_loc, at fold-const.c:1894


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

* [Bug middle-end/50890] [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894
  2011-10-27 21:54 [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894 belyshev at depni dot sinp.msu.ru
@ 2011-10-28  9:45 ` rguenth at gcc dot gnu.org
  2011-10-28 12:45 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-28  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-10-28
         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-10-28 09:45:36 UTC ---
Confirmed.  We should not have inlined the function.  Possibly caused by
my gimple_call_fntype changes, thus mine.


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

* [Bug middle-end/50890] [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894
  2011-10-27 21:54 [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894 belyshev at depni dot sinp.msu.ru
  2011-10-28  9:45 ` [Bug middle-end/50890] " rguenth at gcc dot gnu.org
@ 2011-10-28 12:45 ` rguenth at gcc dot gnu.org
  2011-11-02  8:46 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-28 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-28 12:45:28 UTC ---
Bah, probably triggered by that change but reveals some bigger issue with how
we keep the mismatched-function-flags (gimple_call_cannot_inline_p and
the corresponding edge flag e->call_stmt_cannot_inline_p) up-to-date.

In this case the inliner when inlining emit_pattern_after_noloc turns
the make_raw () call into a direct call but fails to set this flag,
so we inline it during the 2nd early inliner iteration.

Setting that flag at a convenient place with

+  /* Check whether propagating into the function address made the
+     call direct, and thus possibly non-inlineable.
+     ???  This asks for a more conservative setting of the non-inlinable
+     flag, namely true for all indirect calls.  But that would require
+     that we can re-compute the flag conservatively, thus it isn't
+     ever initialized from something else than return/argument type
+     checks .  */
+  callee = gimple_call_fndecl (stmt);
+  if (callee
+      && !gimple_check_call_matching_types (stmt, callee))
+    gimple_call_set_cannot_inline (stmt, true);

during statement folding (CCP can also cause such change when
turning an indirect into a direct call) causes us to hit

#1  0x00000000012b80e7 in can_inline_edge_p (e=0x7ffff5b286e8, report=true)
    at /space/rguenther/src/svn/trunk/gcc/ipa-inline.c:339
339       gcc_checking_assert (!e->call_stmt

because nobody updated the edge flag ... (and I don't think we should
do that from the statement folder).  That's during the 2nd iteration
of the early inliner.

Honza, why do we get away not re-building cgraph edges while
iterating?  What is supposed to keep the edges up-to-date?
I suppose we can adjust the flag when we do

          /* Technically we ought to recompute inline parameters so the new
             iteration of early inliner works as expected.  We however have
             values approximately right and thus we only need to update edge
             info that might be cleared out for newly discovered edges.  */
          for (edge = node->callees; edge; edge = edge->next_callee)
            {
              struct inline_edge_summary *es = inline_edge_summary (edge);
              es->call_stmt_size
                = estimate_num_insns (edge->call_stmt, &eni_size_weights);
              es->call_stmt_time
                = estimate_num_insns (edge->call_stmt, &eni_time_weights);
            }

Testing a patch.


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

* [Bug middle-end/50890] [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894
  2011-10-27 21:54 [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894 belyshev at depni dot sinp.msu.ru
  2011-10-28  9:45 ` [Bug middle-end/50890] " rguenth at gcc dot gnu.org
  2011-10-28 12:45 ` rguenth at gcc dot gnu.org
@ 2011-11-02  8:46 ` rguenth at gcc dot gnu.org
  2011-11-02  8:48 ` rguenth at gcc dot gnu.org
  2011-11-03 19:18 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-02  8:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-02 08:46:12 UTC ---
Author: rguenth
Date: Wed Nov  2 08:46:08 2011
New Revision: 180763

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

    PR tree-optimization/50890
    * gimple.h (gimple_fold_call): Remove.
    * gimple-fold.c (fold_stmt_1): Move all call related code to ...
    (gimple_fold_call): ... here.  Make static.  Update the
    cannot-inline flag on direct calls.
    * ipa-inline.c (early_inliner): Copy the cannot-inline flag
    from the statements to the edges.

    * gcc.dg/torture/pr50890.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr50890.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/gimple.h
    trunk/gcc/ipa-inline.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/50890] [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894
  2011-10-27 21:54 [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894 belyshev at depni dot sinp.msu.ru
                   ` (2 preceding siblings ...)
  2011-11-02  8:46 ` rguenth at gcc dot gnu.org
@ 2011-11-02  8:48 ` rguenth at gcc dot gnu.org
  2011-11-03 19:18 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-02  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-02 08:46:36 UTC ---
Fixed.


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

* [Bug middle-end/50890] [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894
  2011-10-27 21:54 [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894 belyshev at depni dot sinp.msu.ru
                   ` (3 preceding siblings ...)
  2011-11-02  8:48 ` rguenth at gcc dot gnu.org
@ 2011-11-03 19:18 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2011-11-03 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-11-03 19:18:06 UTC ---
The fix has introduced 1 ACATS regression and 1 gnat.dg regression on x86-64.


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

end of thread, other threads:[~2011-11-03 19:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-27 21:54 [Bug middle-end/50890] New: [4.7 Regression] ICE in fold_convert_loc, at fold-const.c:1894 belyshev at depni dot sinp.msu.ru
2011-10-28  9:45 ` [Bug middle-end/50890] " rguenth at gcc dot gnu.org
2011-10-28 12:45 ` rguenth at gcc dot gnu.org
2011-11-02  8:46 ` rguenth at gcc dot gnu.org
2011-11-02  8:48 ` rguenth at gcc dot gnu.org
2011-11-03 19:18 ` ebotcazou 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).