Bug 22049 - M68K Coldfire: ICE in reload_cse_simplify_operands
Summary: M68K Coldfire: ICE in reload_cse_simplify_operands
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.4
: P2 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2005-06-13 14:35 UTC by Jonathan Larmour
Modified: 2006-05-08 15:55 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: m68k-elf
Build: i686-pc-linux-gnu
Known to work: 4.1.0
Known to fail:
Last reconfirmed:


Attachments
Stripped down source file to reproduce problem (784 bytes, text/plain)
2005-06-13 14:38 UTC, Jonathan Larmour
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Larmour 2005-06-13 14:35:32 UTC
I can reliably produce an ICE with a source file with gcc 3.4.4 on m68k-elf. I
have stripped down the preprocessed source file considerably from the original,
and pretty much as far as I can go.  My investigation appears to show it is
dependent on -funit-at-a-time which is why it is not constrained to a single
function.

It can be reproduced when compiled with:
m68k-elf-gcc -c -m5200 -O1 -funit-at-a-time parse.c
which outputs:
parse.c: In function `read_module':
parse.c:149: error: insn does not satisfy its constraints:
(insn 361 630 362 36 parse.c:37 (set (mem/s/j:SI (plus:SI (reg:SI 8 %a0)
                (const_int 8 [0x8])) [0 <variable>.hint+0 S4 A16])
        (mem:SI (plus:SI (reg/f:SI 14 %a6)
                (reg:SI 0 %d0)) [0 hint+0 S4 A16])) 26 {*m68k.md:760} (nil)
    (nil))
parse.c:149: internal compiler error: in reload_cse_simplify_operands, at
postreload.c:391

An earlier version of the sources could reproduce it at -O2, but this stripped
one only now does it with -O1 -funit-at-a-time.

It is highly dependent on just about every line of the input file. I would not
be at all surprised if it was not reproduceable on a heavily modified 3.4.4 or
on 4.0.0, which doesn't mean the problem is necessarily fixed.

I have tried the patch from bug 18421 without effect.
Comment 1 Jonathan Larmour 2005-06-13 14:38:50 UTC
Created attachment 9080 [details]
Stripped down source file to reproduce problem

Compile with:
 m68k-elf-gcc -c -m5200 -O1 -funit-at-a-time parse.c
Note that this source no longer makes logical sense in what it does, due to my
efforts to reduce the size. But it is still valid code.
Comment 2 Jonathan Larmour 2005-06-13 14:48:42 UTC
Oh, one interesting aspect is that the failure is even dependent on some of the
numbers in the switch statement. For example, if the penultimate number is 105
instead of 106 it compiles okay.
Comment 3 Jonathan Larmour 2005-06-13 15:01:58 UTC
Oh, one more thing. The original version of the code, ICE'd on a slightly
different constraint:

(insn 1533 4485 1534 187
/home/jlarmour/ecos/ecospro-common-040929-branch/packages/net/snmp/lib/current/src/parse.c:3505
(set (mem/s/j:QI (plus:SI (reg/f:SI 8 %a0 [256])
                (const_int 8 [0x8])) [0 <variable>.isimplied+0 S1 A32])
        (mem:QI (plus:SI (reg/f:SI 14 %a6)
                (reg:SI 10 %a2)) [0 nextIsImplied+0 S1 A8])) 33 {*m68k.md:826}
(insn_list 1532 (nil))
    (nil))
/home/jlarmour/ecos/ecospro-common-040929-branch/packages/net/snmp/lib/current/src/parse.c:3081:
internal compiler error: in reload_cse_simplify_operands, at postreload.c:391

In the above, it is the insn at m68k.md:826 that appears not to have the right
constraints. If it is helpful, I can attach the preprocessed version of parse.c
that causes the above ICE, but be warned that it is 9041 lines.
Comment 4 Kazu Hirata 2006-05-08 15:55:26 UTC
Not reproducible on mainline.