Bug 59652 - [4.8 Regression] ICE: in reload_cse_simplify_operands, at postreload.c:411
Summary: [4.8 Regression] ICE: in reload_cse_simplify_operands, at postreload.c:411
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: 4.8.3
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 59517 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-12-31 16:40 UTC by John David Anglin
Modified: 2014-01-08 04:01 UTC (History)
0 users

See Also:
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2014-01-04 00:00:00


Attachments
Preprocessed source (87.99 KB, text/plain)
2013-12-31 16:40 UTC, John David Anglin
Details
rtl dump from reload pass (278.47 KB, application/x-gzip)
2013-12-31 16:41 UTC, John David Anglin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2013-12-31 16:40:07 UTC
Created attachment 31551 [details]
Preprocessed source

/usr/lib/gcc/hppa-linux-gnu/4.8/cc1 -fpreprocessed xdvi.i -quiet -dumpbase xdvi
.c -auxbase-strip xdvi.o -g -O2 -Wimplicit -Wreturn-type -Wdeclaration-after-sta
tement -Wno-unknown-pragmas -version -o xdvi.s
GNU C (Debian 4.8.2-10) version 4.8.2 (hppa-linux-gnu)
        compiled by GNU C version 4.8.2, GMP version 5.1.2, MPFR version 3.1.2-p
3, MPC version 1.0.1
warning: GMP header version 5.1.2 differs from library version 5.1.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (Debian 4.8.2-10) version 4.8.2 (hppa-linux-gnu)
        compiled by GNU C version 4.8.2, GMP version 5.1.2, MPFR version 3.1.2-p
3, MPC version 1.0.1
warning: GMP header version 5.1.2 differs from library version 5.1.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: fb24f240bb689ce9d1ca4b08c9c74b8f
../../../texk/xdvik/xdvi.c: In function ‘run_dvi_file’:
../../../texk/xdvik/xdvi.c:3398:1: error: insn does not satisfy its constraints:
 }
 ^
(insn 5859 3068 5860 249 (set (reg:SI 28 %r28)
        (reg/f:SI 2442)) ../../../texk/xdvik/xdvi.c:2722 40 {*pa.md:2211}
     (nil))
../../../texk/xdvik/xdvi.c:3398:1: internal compiler error: in reload_cse_simpli
fy_operands, at postreload.c:411

Problem occurs in handling reloads for following insn:

(insn 3071 3068 3072 249 (set (reg:SF 1959 [ resource.gamma ])
        (mem/c:SF (plus:SI (reg/f:SI 2442)
                (const_int 88 [0x58])) [9 resource.gamma+0 S4 A32])) ../../../te
xk/xdvik/xdvi.c:2722 79 {*pa.md:4386}
     (expr_list:REG_EQUIV (mem/c:SF (plus:SI (reg/f:SI 2442)
                (const_int 88 [0x58])) [9 resource.gamma+0 S4 A32])
        (expr_list:REG_EQUAL (mem/c:SF (const:SI (plus:SI (symbol_ref:SI ("resou
rce") [flags 0x200]  <var_decl 0x4050c660 resource>)                        (const_int 88 [0x58]))) [9 resource.gamma+0 S4 A32])
            (nil))))

Might be target issue but seems more likely to be a reload issue.
Comment 1 John David Anglin 2013-12-31 16:41:38 UTC
Created attachment 31552 [details]
rtl dump from reload pass
Comment 2 John David Anglin 2013-12-31 17:25:20 UTC
It looks to me like the problem arises because reload selected a
call clobbered register, %r1, for reg/f:SI 2442 and there is no way to
reconstitute reg/f:SI 2442 following a call:

(code_label 311 310 312 20 233 "" [3 uses])
(note 312 311 5353 20 [bb 20] NOTE_INSN_BASIC_BLOCK)
(insn 5353 312 5354 20 (set (reg:SI 1 %r1)
        (high:SI (symbol_ref:SI ("resource") [flags 0x200]  <var_decl 0x4050c660
 resource>))) ../../../texk/xdvik/xdvi.c:3003 52 {*pa.md:2686}
     (nil))
(insn 5354 5353 315 20 (set (reg:SI 1 %r1)
        (lo_sum:SI (reg:SI 1 %r1)
            (symbol_ref:SI ("resource") [flags 0x200]  <var_decl 0x4050c660 reso
urce>))) ../../../texk/xdvik/xdvi.c:3003 55 {*pa.md:2766}
     (nil))
(insn 315 5354 316 20 (set (reg/f:SI 28 %r28 [orig:949 resource.src_pos ] [949])
        (mem/f/c:SI (plus:SI (reg:SI 1 %r1)
                (const_int 172 [0xac])) [5 resource.src_pos+0 S4 A32])) ../../..
/texk/xdvik/xdvi.c:3003 40 {*pa.md:2211}
     (expr_list:REG_EQUIV (mem/f/c:SI (plus:SI (reg/f:SI 2442)
                (const_int 172 [0xac])) [5 resource.src_pos+0 S4 A32])
        (expr_list:REG_EQUAL (mem/f/c:SI (const:SI (plus:SI (symbol_ref:SI ("resource") [flags 0x200]  <var_decl 0x4050c660 resource>)
                        (const_int 172 [0xac]))) [5 resource.src_pos+0 S4 A32])
            (nil))))
Comment 3 John David Anglin 2014-01-03 18:56:26 UTC
With

dave@mx3210:~/gnu/gcc/objdir/prev-gcc$ ./xgcc -B./ -v
Reading specs from ./specs
COLLECT_GCC=./xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: hppa-linux-gnu
Configured with: ../gcc/configure --with-gnu-as --with-gnu-ld --enable-shared --enable-multiarch --enable-linker-build-id --build=hppa-linux-gnu --host=hppa-linux-gnu --target=hppa-linux-gnu --prefix=/home/dave/opt/gnu/gcc/gcc-4.9 --with-local-prefix=/home/dave/opt/gnu --enable-threads=posix --enable-__cxa_atexit --build=hppa-linux-gnu --enable-clocale=gnu --enable-java-gc=boehm --enable-languages=c,c++,objc,fortran,obj-c++,java,ada,lto
Thread model: posix
gcc version 4.8.3 20140103 (prerelease) [gcc-4_8-branch revision 206321] (GCC) 

I see the following backtrace when the insn was emitted:

Breakpoint 1, pa_emit_move_sequence (operands=0xfaf02e8c, mode=SImode, 
    scratch_reg=0x0) at ../../gcc/gcc/config/pa/pa.c:1583
1583	  register rtx operand0 = operands[0];
(gdb) p debug_rtx(operands[0])(reg:SI 28 %r28)
$5 = void
(gdb) p debug_rtx(operands[1])
(reg/f:SI 2442)
$6 = void
(gdb) bt
#0  pa_emit_move_sequence (operands=0xfaf02e8c, mode=SImode, scratch_reg=0x0)
    at ../../gcc/gcc/config/pa/pa.c:1583
#1  0x00bf77bc in gen_movsi (operand0=0xfaf02e8c, operand1=0x7)
    at ../../gcc/gcc/config/pa/pa.md:2157
#2  0x00bf77bc in gen_movsi (operand0=0x4022c030, operand1=0x40a0d040)
    at ../../gcc/gcc/config/pa/pa.md:2157
#3  0x00446334 in insn_gen_fn::operator() (this=0xf9e720 <insn_data+8336>, 
    a0=0x4022c030, a1=0x40a0d040) at ../../gcc/gcc/recog.h:284
#4  0x00424864 in emit_move_insn_1 (x=0x4022c030, y=0x40a0d040)
    at ../../gcc/gcc/expr.c:3441
#5  0x006e6278 in gen_move_insn (x=0x4022c030, y=0x40a0d040)
    at ../../gcc/gcc/optabs.c:4812
#6  0x006e6278 in gen_move_insn (x=0x4022c030, y=0x40a0d040)
    at ../../gcc/gcc/optabs.c:4812
#7  0x007a5794 in gen_reload (out=0x4022c030, in=0x40a0d040, opnum=1, 
    type=RELOAD_FOR_INPUT_ADDRESS) at ../../gcc/gcc/reload1.c:8708
(gdb) c
Continuing.

Breakpoint 1, pa_emit_move_sequence (operands=0xfaf02e8c, mode=SImode, 
    scratch_reg=0x0) at ../../gcc/gcc/config/pa/pa.c:1583
1583	  register rtx operand0 = operands[0];
(gdb) p debug_rtx(operands[0])
(reg:SI 19 %r19)
$7 = void
(gdb) c
Continuing.

Breakpoint 1, pa_emit_move_sequence (operands=0xfaf02e8c, mode=SImode, 
    scratch_reg=0x0) at ../../gcc/gcc/config/pa/pa.c:1583
1583	  register rtx operand0 = operands[0];
(gdb) p debug_rtx(operands[0])
(reg:SI 19 %r19)
$8 = void
(gdb) c
Continuing.
../../../texk/xdvik/xdvi.c: In function ‘run_dvi_file’:
../../../texk/xdvik/xdvi.c:3398:1: error: insn does not satisfy its constraints:
(insn 5859 3068 5860 249 (set (reg:SI 28 %r28)
        (reg/f:SI 2442)) ../../../texk/xdvik/xdvi.c:2722 40 {*pa.md:2211}
     (nil))
../../../texk/xdvik/xdvi.c:3398:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:411
0x7b8797 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
	../../gcc/gcc/rtl-error.c:109
0x7b880f _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
	../../gcc/gcc/rtl-error.c:120
0x70d52b reload_cse_simplify_operands
	../../gcc/gcc/postreload.c:411
0x70c753 reload_cse_simplify
	../../gcc/gcc/postreload.c:123
0x70cb7b reload_cse_regs_1
	../../gcc/gcc/postreload.c:220
0x70c4f3 reload_cse_regs
	../../gcc/gcc/postreload.c:68
0x71484f rest_of_handle_postreload
	../../gcc/gcc/postreload.c:2287
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
[Inferior 1 (process 6751) exited with code 04]
Comment 4 John David Anglin 2014-01-04 22:38:46 UTC
*** Bug 59517 has been marked as a duplicate of this bug. ***
Comment 5 John David Anglin 2014-01-04 22:40:41 UTC
Testing fix.
Comment 6 John David Anglin 2014-01-07 02:56:34 UTC
The fundamental issue is how these insns are reloaded:

(insn 223 222 224 7 (set (reg/f:SI 2448)        (high:SI (symbol_ref:SI ("resource") [flags 0x200]  <var_decl 0x40579660
 resource>))) ../../../texk/xdvik/xdvi.c:2968 52 {*pa.md:2686}
     (expr_list:REG_EQUIV (high:SI (symbol_ref:SI ("resource") [flags 0x200]  <v
ar_decl 0x40579660 resource>))
        (nil)))
(insn 224 223 226 7 (set (reg/f:SI 2442)
        (lo_sum:SI (reg/f:SI 2448)
            (symbol_ref:SI ("resource") [flags 0x200]  <var_decl 0x40579660 resource>))) ../../../texk/xdvik/xdvi.c:2968 55 {*pa.md:2766}
     (expr_list:REG_EQUIV (symbol_ref:SI ("resource") [flags 0x200]  <var_decl 0x40579660 resource>)
        (nil)))
(insn 226 224 227 7 (set (reg:SI 936 [ resource.unique+-3 ])
        (zero_extend:SI (mem/c:QI (plus:SI (reg/f:SI 2442)
                    (const_int 201 [0xc9])) [0 resource.unique+0 S1 A8]))) ../../../texk/xdvik/xdvi.c:2968 84 {*pa.md:4628}
     (nil))

Insn 224 ends up being deleted.  I'm not sure why because reg/f:SI 2442
appears to be needed in insn 226 and later insns.  What happens is reload
does an input reload for insn 226, but gets in trouble later.

The best fix that I have at the moment is to inhibit generation of REG+D
instructions prior to reload.
Comment 7 John David Anglin 2014-01-08 01:58:37 UTC
Author: danglin
Date: Wed Jan  8 01:58:35 2014
New Revision: 206413

URL: http://gcc.gnu.org/viewcvs?rev=206413&root=gcc&view=rev
Log:
	PR target/59652
	* config/pa/pa.c (pa_legitimate_address_p): Return false before reload
	for 14-bit register offsets when INT14_OK_STRICT is false.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/pa/pa.c
Comment 8 John David Anglin 2014-01-08 02:01:53 UTC
Author: danglin
Date: Wed Jan  8 02:01:50 2014
New Revision: 206414

URL: http://gcc.gnu.org/viewcvs?rev=206414&root=gcc&view=rev
Log:
	PR target/59652
	* config/pa/pa.c (pa_legitimate_address_p): Return false before reload
	for 14-bit register offsets when INT14_OK_STRICT is false.


Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/pa/pa.c
Comment 9 John David Anglin 2014-01-08 04:01:35 UTC
More or less fixed...