This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/15286] New: ICE cause by reload


A client test case ICEs in reload when compiled with -mcpu=G5 and -O1 (and above)
for apple-ppc-darwin.
This happens with mainline and tree-ssa gcc. But it may or may not fail with some
compilers (behavior is quite random and ICE happens if there is no hard register available
during reload, forcing store into temporary stack).

Code which causes this problem is (of course this sample does not ICE):

typedef unsigned long clock_t;

clock_t clock();

void foo()
{
        clock_t clock_start;

        clock_start=(((double)clock())/((double)(100)));
}

Problem is that gcc3.5 generates this RTL pattern for apple-ppc-dawin:

(insn 30 29 32 2 (set (subreg:DI (reg/v:SI 142 [ clock_start ]) 0)
        (fix:DI (reg:DF 158))) 216 {fix_truncdfdi2} (insn_list 28 (nil))
    (expr_list:REG_DEAD (reg:DF 158)
        (nil)))

Reload initially assigns hard register f0 to pseudo register 158, thus the pattern:

(insn 30 29 32 2 (set (subreg:DI (reg/v:SI 142 [ clock_start ]) 0)
        (fix:DI (reg:DF 32 f0 [158]))) 216 {fix_truncdfdi2} (insn_list 28 (nil))
    (expr_list:REG_DEAD (reg:DF 32 f0 [158])
        (nil)))

When there is no hard register available for  pseudo reg 142, reload will allocate
memory on stack to do a store/load operation. But to do so, reload generates the
following pattern:

(subreg:SI (reg:DI 32 f0) 4)

This is wrong. There is no movsi of an FPR. gcc then ICEs on:

error: unrecognizable insn:
(insn 247 30 32 2 (set (mem:SI (plus:SI (reg/f:SI 1 r1)
                (const_int 492 [0x1ec])) [0 clock_start+0 S4 A8])
        (subreg:SI (reg:DI 32 f0) 4)) -1 (nil)
    (nil))

-- 
           Summary: ICE cause by reload
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fjahanian at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.0.0
  GCC host triplet: powerpc-apple-darwin7.0.0
GCC target triplet: powerpc-apple-darwin7.0.0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]