public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/28982]  New: Incorrect reloading of automodification expressions
@ 2006-09-08  8:35 rsandifo at gcc dot gnu dot org
  2006-09-08  8:37 ` [Bug rtl-optimization/28982] " rsandifo at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-09-08  8:35 UTC (permalink / raw)
  To: gcc-bugs

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  <paul@codesourcery.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)
    (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
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
GCC target triplet: arm-none-linux-gnueabi


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/28982] Incorrect reloading of automodification expressions
  2006-09-08  8:35 [Bug rtl-optimization/28982] New: Incorrect reloading of automodification expressions rsandifo at gcc dot gnu dot org
@ 2006-09-08  8:37 ` rsandifo at gcc dot gnu dot org
  2006-09-13  6:31 ` rsandifo at gcc dot gnu dot org
  2006-09-13  6:32 ` rsandifo at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-09-08  8:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rsandifo at gcc dot gnu dot org  2006-09-08 08:37 -------
Created an attachment (id=12211)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12211&action=view)
Testcase

This brute-force test fails with -O2 -mfloat-abi=softfp.


-- 

rsandifo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rsandifo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/28982] Incorrect reloading of automodification expressions
  2006-09-08  8:35 [Bug rtl-optimization/28982] New: Incorrect reloading of automodification expressions rsandifo at gcc dot gnu dot org
  2006-09-08  8:37 ` [Bug rtl-optimization/28982] " rsandifo at gcc dot gnu dot org
@ 2006-09-13  6:31 ` rsandifo at gcc dot gnu dot org
  2006-09-13  6:32 ` rsandifo at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-09-13  6:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rsandifo at gcc dot gnu dot org  2006-09-13 06:31 -------
Subject: Bug 28982

Author: rsandifo
Date: Wed Sep 13 06:30:59 2006
New Revision: 116919

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116919
Log:
gcc/
        PR rtl-optimization/28982
        * reload.c (find_reloads_address_1): Use RELOAD_OTHER for the
        index of a PRE_MODIFY or POST_MODIFY address.
        * reload1.c (inc_for_reload): Use find_replacement on the original
        base and index registers.

gcc/testsuite/
        PR rtl-optimization/28982
        * gcc.c-torture/execute/pr28982a.c: New test.
        * gcc.c-torture/execute/pr28982b.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr28982a.c
    trunk/gcc/testsuite/gcc.c-torture/execute/pr28982b.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reload.c
    trunk/gcc/reload1.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/28982] Incorrect reloading of automodification expressions
  2006-09-08  8:35 [Bug rtl-optimization/28982] New: Incorrect reloading of automodification expressions rsandifo at gcc dot gnu dot org
  2006-09-08  8:37 ` [Bug rtl-optimization/28982] " rsandifo at gcc dot gnu dot org
  2006-09-13  6:31 ` rsandifo at gcc dot gnu dot org
@ 2006-09-13  6:32 ` rsandifo at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2006-09-13  6:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rsandifo at gcc dot gnu dot org  2006-09-13 06:32 -------
Patch applied


-- 

rsandifo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-13  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-08  8:35 [Bug rtl-optimization/28982] New: Incorrect reloading of automodification expressions rsandifo at gcc dot gnu dot org
2006-09-08  8:37 ` [Bug rtl-optimization/28982] " rsandifo at gcc dot gnu dot org
2006-09-13  6:31 ` rsandifo at gcc dot gnu dot org
2006-09-13  6:32 ` rsandifo at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).