Bug 48380 - [gcc-4.7 regression] ICE in postreload.c while building trunk
Summary: [gcc-4.7 regression] ICE in postreload.c while building trunk
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.0
: P3 blocker
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, ra
Depends on:
Blocks:
 
Reported: 2011-03-31 03:27 UTC by revital.eres
Modified: 2011-04-06 16:22 UTC (History)
5 users (show)

See Also:
Host: arm-linux-gnueabi
Target: arm-linux-gnueabi, arm-eabi
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test inspired from libgcov.c (1.36 KB, text/plain)
2011-03-31 08:38 UTC, revital.eres
Details
testcase reduced from libgfortran (652 bytes, text/plain)
2011-03-31 21:05 UTC, Richard Earnshaw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description revital.eres 2011-03-31 03:27:02 UTC
While building trunk -r171741 I get the following error on ARM machine configured with:
../gcc/configure --enable-checking --enable-languages=c,c++,lto,fortran --disable-bootstrap --with-mpfr=/opt/cfarm/mpfr-2.4.2 --with-gmp=/opt/cfarm/gmp-4.2.4 --with-mpc=/opt/cfarm/mpc-0.8 --with-arch=armv7-a

/home/revitale/mainline/build/./gcc/xgcc -B/home/revitale/mainline/build/./gcc/ -B/home/revitale/mainline/build/armv7l-unknown-linux-gnueabi/bin/ -B/home/revitale/mainline/build/armv7l-unknown-linux-gnueabi/lib/ -isystem /home/revitale/mainline/build/armv7l-unknown-linux-gnueabi/include -isystem /home/revitale/mainline/build/armv7l-unknown-linux-gnueabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -Wno-missing-prototypes -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector   -I. -I. -I../.././gcc -I../../../gcc/libgcc -I../../../gcc/libgcc/. -I../../../gcc/libgcc/../gcc -I../../../gcc/libgcc/../include  -DHAVE_CC_TLS  -o _gcov.o -MT _gcov.o -MD -MP -MF _gcov.dep -DL_gcov -c ../../../gcc/libgcc/../gcc/libgcov.c
../../../gcc/libgcc/../gcc/libgcov.c: In function גgcov_exitג:
../../../gcc/libgcc/../gcc/libgcov.c:558:1: error: insn does not satisfy its constraints:
(insn 2032 232 231 3 (set (reg:DI 256 [ this_program__sum_all_lsm.184 ])
        (reg:DI 6 r6)) 165 {*arm_movdi}
     (nil))
../../../gcc/libgcc/../gcc/libgcov.c:558:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [_gcov.o] Error 1
make[2]: Leaving directory `/home/revitale/mainline/build/armv7l-unknown-linux-gnueabi/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/revitale/mainline/build'
make: *** [all] Error 2
Comment 1 revital.eres 2011-03-31 08:38:40 UTC
Created attachment 23834 [details]
Test inspired from libgcov.c

Command to run the test on ARM machine:

/home/revitale/mainline/build/./gcc/xgcc -B/home/revitale/mainline/build/./gcc/  -g -O2 -O2  -g -O2 k13.c
Comment 2 Richard Earnshaw 2011-03-31 21:04:29 UTC
Here's another case which is probably the same problem.

compile on an arm-eabi cross with 

cc1 -g -O2 -mfloat-abi=hard -std=gnu99 bad.c
Comment 3 Richard Earnshaw 2011-03-31 21:05:55 UTC
Created attachment 23843 [details]
testcase reduced from libgfortran
Comment 4 Vladimir Makarov 2011-04-01 20:47:39 UTC
We have the following situation:
  - a pseudo has equivalent constant.
  - a loop allocno corresponding to the pseudo got hard reg and
    the subloop allocno got memory.
  - the load generated by IRA on the loop/subloop border is not removed.
  - the loop allocno is spilled in reload transforming the load into mem-mem move.
  - reload skip processing the move because it sets up regno with equiv constant.
  - gcc dies in the post=reload.

There are several possible solutions but the most optimal would be removing the load transformed into mem-mem move in the reload.  We need to add the load to equiv init insn.

I'll submit a patch solving the problem soon.
Comment 5 Vladimir Makarov 2011-04-04 20:19:48 UTC
Author: vmakarov
Date: Mon Apr  4 20:19:45 2011
New Revision: 171951

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171951
Log:
2011-04-01  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/48380
	* ira.c (ira): Call grow_reg_equivs when fix_reg_equiv_init is
          not called.

	* ira-emit.c (emit_move_list): Update reg equiv init insn list.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ira-emit.c
    trunk/gcc/ira.c
Comment 6 Jeffrey A. Law 2011-04-06 16:22:19 UTC
Should be fixed by Vlad's patch.