Bug 8705 - [3.2 regression] [HP-PA] ICE in emit_move_insn_1, at expr.c:3101
Summary: [3.2 regression] [HP-PA] ICE in emit_move_insn_1, at expr.c:3101
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: John David Anglin
Keywords: ice-on-valid-code
Depends on:
Reported: 2002-11-25 13:16 UTC by psilord
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description psilord 2002-11-25 13:16:02 UTC
Compile fails with internal compiler error when -O2 is used on this piece of code(preprocessed):

# 1 "bug.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bug.c"
int main(void)
        double a,b,c,eps;

        a = 4.0e0/3.0e0;
        eps = 0.0e0;
        while (eps == 0.0e0) {
                b = a - 1.0e0;
        return 0;

gcc -v -O2 bug.c
Reading specs from /tools/local/gcc64/lib/gcc-lib/hppa64-hp-hpux11.00/3.2/specs
Configured with: ../gcc-3.2/configure --disable-nls --host=hppa64-hp-hpux11.00 --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/tools/local/bin/as --prefix=/tools/local/gcc64 --with-nm=/tools/local/bin/nm --disable-shared
Thread model: single
gcc version 3.2
 /tools/local/gcc64/lib/gcc-lib/hppa64-hp-hpux11.00/3.2/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ -D__hppa -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -Asystem=unix -Asystem=hpux -Acpu=hppa -Amachine=hppa -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -D_PA_RISC1_1 -D__hp9000s700 -D_PA_RISC2_0 -D__hp9000s800 -D__LP64__ -D__LONG_MAX__=9223372036854775807L -D_HPUX_SOURCE -D_HIUX_SOURCE -D__STDC_EXT__ -D_INCLUDE_LONGLONG bug.c -quiet -dumpbase bug.c -O2 -version -o /var/tmp//ccwPmTpQ.s
GNU CPP version 3.2 (cpplib) (hppa)
GNU C version 3.2 (hppa64-hp-hpux11.00)
        compiled by GNU C version 3.2.
ignoring nonexistent directory "/tools/local/gcc64/hppa64-hp-hpux11.00/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list.
bug.c: In function `main':
bug.c:11: Internal compiler error in emit_move_insn_1, at expr.c:3101
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

gcc version 3.2 official release

Machine is: hppa64-hp-hpux11.00 model:9000/780/J282

Process used to build gcc 3.2 on above machine:

set path = ( /opt/ansic/bin $path )
setenv CC 'cc -Ae +DA2.0W'

Building binutils 2.13.1
./configure --prefix=/tools/local --disable-shared \ --disable-nls --host=hppa64-hp-hpux11.00

Then building gcc 3.2:
../gcc-3.2/configure --disable-nls \ --host=hppa64-hp-hpux11.00 --without-gnu-ld \ --with-ld=/usr/ccs/bin/ld --with-gnu-as --with-as=/tools/local/bin/as --prefix=/tools/local/gcc64 \ --with-nm=/tools/local/bin/nm --disable-shared && make bootstrap-lean

gcc -O2 bug.c
Comment 1 psilord 2002-11-25 13:16:02 UTC
A fix has been applied to the PA backend to the 3.3 branch
and the trunk to prevent the ICE.

< http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01536.html>

However, the patch doesn't fix the underlying problem.  The
loop pass is moving sets of the CCFP condition code register
out of loops.  This makes it much more difficult to
optimize conditional jumps.  It also requires that the
backend support a means to set the condition code

The values of condition code registers are not tracked as
other registers.  Thus, conditional jumps are not simplified
in the CSE pass when they involve a CC_MODE register.
Conditional jumps can be simplified in the combine pass
but only if the set of the CC_MODE register and the jump
are together.  Thus, moving a set of a CC_MODE register
isn't a good idea.

A possible real fix might be to define the floating point
status register as a register known to GCC, supporting
BImode integer operations.
Comment 2 Volker Reichelt 2002-11-28 07:54:59 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    I can reproduce the bug on mips-sgi-irix6.5 (but not on i686-pc-linux-gnu)
    with gcc 3.1 - 3.2.1. Mainline and 3.0.x are not affected.
    I can even use a smaller testcase:
    ------------------------snip here--------------------
    void foo(void)
        double a=0, eps=0;
        while (eps) a-=1;
    ------------------------snip here--------------------
Comment 3 John David Anglin 2003-04-25 01:00:58 UTC
Responsible-Changed-From-To: unassigned->danglin
Responsible-Changed-Why: Assignment.
Comment 4 John David Anglin 2003-04-25 01:00:58 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed on 3.3 branch and main.