[Bug rtl-optimization/28982] New: Incorrect reloading of automodification expressions
rsandifo at gcc dot gnu dot org
Fri Sep 8 08:35:00 GMT 2006
If reload decides to create an automodification reload (POST_MODIFY, etc.),
inc_for_reload will not deal correctly with any reloads for the base and
index registers. This problem is related to:
2006-03-29 Paul Brook <email@example.com>
* reload1.c (choose_reload_regs): Check for all RTX_AUTOINC operators.
(inc_for_reload): Handle PRE_MODIFY and POST_MODIFY addresses.
...before which, any attempt to create PRE_MODIFY and POST_MODIFY
reloads would cause an ICE.
The symptoms are twofold. If an index register is reloaded from
a spill slot, you'll get an ICE such as:
error: unrecognizable insn:
(insn 481 479 482 3 (set (reg:SI 1 r1)
(plus:SI (reg:SI 1 r1)
(mem/c:SI (plus:SI (reg/f:SI 13 sp)
(const_int 176 [0xb0])) [25 pretmp.56+0 S4 A32]))) -1 (nil)
If the base register is reloaded from a spill slot, the modification
will be lost.
There is a third problem. Suppose there's a RELOAD_FOR_INPUT reload (A)
that reloads a PRE_MODIFY or POST_MODIFY and a reload (B) that reloads
the index of that PRE_MODIFY or POST_MODIFY. (B) will then be a
RELOAD_FOR_INPUT_ADDRESS. This is incorrect, as inc_for_reload might
only read the index _after_ setting (A)'s reload register, so (B)'s
reload register must live longer than a normal RELOAD_FOR_INPUT_ADDRESS
is required to.
Because Paul's patch is 4.2-only, and because POST_MODIFY reloads
would ICE before his patch, the bug is only a 4.2 regression in
the sense that an ice-on-valid-code bug can now sometimes be a
more serious wrong-code bug.
Summary: Incorrect reloading of automodification expressions
Keywords: wrong-code, ice-on-valid-code
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rsandifo at gcc dot gnu dot org
GCC target triplet: arm-none-linux-gnueabi
More information about the Gcc-bugs