Bug 43348 - [4.4 regression] ICE in final_scan_insn, at final.c:2604
Summary: [4.4 regression] ICE in final_scan_insn, at final.c:2604
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: 4.4.4
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-03-12 18:42 UTC by Matthias Klose
Modified: 2010-03-23 01:37 UTC (History)
3 users (show)

See Also:
Host:
Target: ia64-linux-gnu
Build:
Known to work: 4.3.4 4.4.3 4.5.0
Known to fail: 4.4.4
Last reconfirmed:


Attachments
preprocessed source (199.65 KB, application/x-lzma)
2010-03-12 18:43 UTC, Matthias Klose
Details
untested patch for gcc-4.4 (539 bytes, patch)
2010-03-17 01:50 UTC, Jim Wilson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2010-03-12 18:42:11 UTC
seen with current 4.4 branch on ia64-linux, not on the trunk and 4.3. goes away removing -fno-strict-aliasing, or setting the optimization to -Os or -O1:

$ g++ -c -g -O2 -fno-strict-aliasing SerializedScriptValue.ii
bindings/js/SerializedScriptValue.cpp: In function 'typename TreeWalker::OutputType WebCore::walk(TreeWalker&, typename TreeWalker::InputType) [with TreeWalker = WebCore::SerializingTreeWalker]':
bindings/js/SerializedScriptValue.cpp:343: error: could not split insn
(call_insn 4851 19696 19697 347 ../JavaScriptCore/wtf/Vector.h:284 (parallel [
            (call (mem:DI (const_int 0 [0x0]) [0 S8 A64])
                (const_int 1 [0x1]))
            (clobber (reg:DI 320 b0))
            (clobber (scratch:DI))
            (clobber (scratch:DI))
        ]) 354 {call_gp} (expr_list:REG_DEAD (reg:DI 1 r1)
        (expr_list:REG_EH_REGION (const_int 124 [0x7c])
            (nil)))
    (expr_list:REG_DEP_TRUE (use (reg:DI 1 r1))
        (nil)))
bindings/js/SerializedScriptValue.cpp:343: internal compiler error: in final_scan_insn, at final.c:2604
Comment 1 Matthias Klose 2010-03-12 18:43:27 UTC
Created attachment 20096 [details]
preprocessed source
Comment 2 Mikael Pettersson 2010-03-13 14:28:55 UTC
I can reproduce this with a gcc-4.4-20100309 cross to ia64-linux hosted on i686-linux. A gcc-4.4.3 cross works, so this must be recent regression.
Comment 3 Matthias Klose 2010-03-13 15:28:13 UTC
r156416 is ok, r156863 not
Comment 4 Mikael Pettersson 2010-03-13 16:33:25 UTC
This is caused by r156601:

Author: rguenth
Date: Mon Feb  8 14:10:15 2010
New Revision: 156601

URL: http://gcc.gnu.org/viewcvs?root=3Dgcc&view=3Drev&rev=3D156601
Log:
2010-02-08  Richard Guenther  <rguenther@suse.de>

        PR middle-end/42995
        * tree-inline.c (estimate_move_cost): Assert we are not called
        with a void type.
        (estimate_num_insns): Do not count the terminating void_type_node
        of a function argument type list.

        Backport from mainline:
        2010-01-06  Richard Guenther  <rguenther@suse.de>

        * ipa-inline.c (cgraph_decide_inlining_incrementally): Do
        not inline regular functions into always-inline functions.

        2010-01-05  Martin Jambor  <mjambor@suse.cz>

        PR tree-optimization/42462
        * ipa-inline.c (compute_inline_parameters): Pass node->decl instead of
        current_function_decl to helper functions and macros.

        * gcc.dg/tree-ssa/inline-4.c: New testcase.
        * gcc.dg/Wunreachable-2.c: Remove.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c
Removed:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/Wunreachable-2.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/ipa-inline.c
    branches/gcc-4_4-branch/gcc/tree-inline.c
Comment 5 Mikael Pettersson 2010-03-14 11:45:34 UTC
Disabling the "Do not inline regular functions into always-inline functions" part of r156601 prevents the ICE:

--- gcc-4.4-20100209/gcc/ipa-inline.c.~1~
+++ gcc-4.4-20100209/gcc/ipa-inline.c
@@ -1421,7 +1421,7 @@ cgraph_decide_inlining_incrementally (st
   if (mode != INLINE_ALL && mode != INLINE_ALWAYS_INLINE
       /* Never inline regular functions into always-inline functions
         during incremental inlining.  */
-      && !node->local.disregard_inline_limits)
+      /* && !node->local.disregard_inline_limits*/)
     for (e = node->callees; e; e = e->next_callee)
       {
        if (!e->callee->local.inlinable
Comment 6 wilson@codesourcery.com 2010-03-17 01:46:29 UTC
Subject: Re:   New: [4.4 regression] ICE in final_scan_insn,
 at final.c:2604

The testcase has
>            if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
>                 do { *(int *)(uintptr_t)0xbbadbeef = 0; ((void(*)())0)(); } while(false);
which is not very C++ish, but none the less should "work".

The problem is in the ia64.md file.  The call patterns use the predicate 
call_operand which accepts only symbol_ref and register, and constraints 
that include a register "b" and "i".  The call operand remains a 
register until reload, which sees that we have a register equivalent to 
zero and an "i" constraint and does the substitution.  After reload, we 
then fail, as call_operand does not accept const_int.

We need to fix the ia64.md call patterns to use "s" instead of "i". 
This bug has apparently been present since the port was submitted in 
gcc-3.0.
Comment 7 Jim Wilson 2010-03-17 01:50:43 UTC
Created attachment 20121 [details]
untested patch for gcc-4.4

We will also need an equivalent patch for mainline/4.5.
Comment 8 Matthias Klose 2010-03-18 00:52:50 UTC
checked that this patch fixes the testcase, and doesn't show any regressions on ia64-linux-gnu for the testsuite (4.4 branch 20100311).
Comment 9 Jim Wilson 2010-03-23 01:16:26 UTC
Subject: Bug 43348

Author: wilson
Date: Tue Mar 23 01:16:10 2010
New Revision: 157659

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157659
Log:
PR target/43348
* ia64.md (call_nogp, call_value_nogp, sibcall_nogp, call_gp,
call_value_gp,sibcall_gp): Use 's' constraint not 'i'.

Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/ia64/ia64.md

Comment 10 Jim Wilson 2010-03-23 01:22:49 UTC
Subject: Bug 43348

Author: wilson
Date: Tue Mar 23 01:22:28 2010
New Revision: 157660

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157660
Log:
PR target/43348
* ia64.md (call_nogp, call_value_nogp, sibcall_nogp, call_gp,
call_value_gp,sibcall_gp): Use 's' constraint not 'i'.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/ia64/ia64.md

Comment 11 Jim Wilson 2010-03-23 01:36:57 UTC
Fixed on gcc-4.4 branch and mainline.