public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia
@ 2011-07-05 12:19 sebastian.huber@embedded-brains.de
  2011-07-06  6:27 ` [Bug target/49641] " sebastian.huber@embedded-brains.de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2011-07-05 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [ARM] Wrong code for ARMv4T and stmia
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sebastian.huber@embedded-brains.de
            Target: arm-rtemseabi4.11


Created attachment 24689
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24689
Sample code.

The attached source code generates the following assembler code:

00000000 <_Watchdog_Handler_initialization>:
   0:   2200            movs    r2, #0
   2:   4b06            ldr     r3, [pc, #24]   ; (1c
<_Watchdog_Handler_initialization+0x1c>)
   4:   601a            str     r2, [r3, #0]
   6:   4b06            ldr     r3, [pc, #24]   ; (20
<_Watchdog_Handler_initialization+0x20>)
   8:   601a            str     r2, [r3, #0]
   a:   4b06            ldr     r3, [pc, #24]   ; (24
<_Watchdog_Handler_initialization+0x24>)
   c:   601a            str     r2, [r3, #0]
   e:   4b06            ldr     r3, [pc, #24]   ; (28
<_Watchdog_Handler_initialization+0x28>)
  10:   1d19            adds    r1, r3, #4
  12:   c30e            stmia   r3!, {r1, r2, r3}
  14:   4b05            ldr     r3, [pc, #20]   ; (2c
<_Watchdog_Handler_initialization+0x2c>)
  16:   1d19            adds    r1, r3, #4
  18:   c30e            stmia   r3!, {r1, r2, r3}
  1a:   4770            bx      lr

In particular it generates: stmia r3!, {r1, r2, r3}

This instruction leads to UNPREDICTABLE behavior.  According to "ARM
Architecture Reference Manual, Issue I" we have in section "A7.1.57 STMIA",
"Operand restrictions":

"If <Rn> is specified in <registers>:
 o If <Rn> is the lowest-numbered register specified in <registers>, the
original value of <Rn> is stored.
 o Otherwise, the stored value of <Rn> is UNPREDICTABLE."

Since r3 is not the lowest-numbered register specified in {r1, r2, r3} the
stored value of r3 is UNPREDICTABLE.


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

* [Bug target/49641] [ARM] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
@ 2011-07-06  6:27 ` sebastian.huber@embedded-brains.de
  2011-07-06  8:32 ` [Bug target/49641] [4.6 Regression] " rearnsha at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2011-07-06  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

Sebastian Huber <sebastian.huber@embedded-brains.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.4.6
      Known to fail|                            |4.6.1

--- Comment #1 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2011-07-06 06:27:23 UTC ---
The command line is:

arm-rtemseabi4.11-gcc -mcpu=arm7tdmi-s -mfpu=vfp -mfloat-abi=soft -mthumb -O2
-c watchdog.i

We also get an assembler warning:

watchdog.s: Assembler messages:
watchdog.s:29: Warning: value stored for r3 is UNKNOWN
watchdog.s:32: Warning: value stored for r3 is UNKNOWN

Is the ARM7TDMI-S core still supported by GCC or is it too old?


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
  2011-07-06  6:27 ` [Bug target/49641] " sebastian.huber@embedded-brains.de
@ 2011-07-06  8:32 ` rearnsha at gcc dot gnu.org
  2011-08-01 14:32 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2011-07-06  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.06 08:31:43
                 CC|                            |bernds at gcc dot gnu.org
            Summary|[ARM] Wrong code for ARMv4T |[4.6 Regression] Wrong code
                   |and stmia                   |for ARMv4T and stmia
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-07-06 08:31:43 UTC ---
This is the regression caused by the new ldm/stm optimizers that were added for
4.6


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
  2011-07-06  6:27 ` [Bug target/49641] " sebastian.huber@embedded-brains.de
  2011-07-06  8:32 ` [Bug target/49641] [4.6 Regression] " rearnsha at gcc dot gnu.org
@ 2011-08-01 14:32 ` rguenth at gcc dot gnu.org
  2011-08-01 14:42 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-01 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.2


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (2 preceding siblings ...)
  2011-08-01 14:32 ` rguenth at gcc dot gnu.org
@ 2011-08-01 14:42 ` rguenth at gcc dot gnu.org
  2011-08-02 13:11 ` bernds at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-01 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (3 preceding siblings ...)
  2011-08-01 14:42 ` rguenth at gcc dot gnu.org
@ 2011-08-02 13:11 ` bernds at gcc dot gnu.org
  2011-08-22 11:10 ` sebastian.huber@embedded-brains.de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bernds at gcc dot gnu.org @ 2011-08-02 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Bernd Schmidt <bernds at gcc dot gnu.org> 2011-08-02 13:11:07 UTC ---
http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01044.html
http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02174.html


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (4 preceding siblings ...)
  2011-08-02 13:11 ` bernds at gcc dot gnu.org
@ 2011-08-22 11:10 ` sebastian.huber@embedded-brains.de
  2011-09-12  9:23 ` sebastian.huber@embedded-brains.de
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2011-08-22 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2011-08-22 11:00:07 UTC ---
The patch from Bernd Schmidt fixes the problem in my case.  What is the status
of this patch?


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (5 preceding siblings ...)
  2011-08-22 11:10 ` sebastian.huber@embedded-brains.de
@ 2011-09-12  9:23 ` sebastian.huber@embedded-brains.de
  2011-10-26 17:22 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sebastian.huber@embedded-brains.de @ 2011-09-12  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

Sebastian Huber <sebastian.huber@embedded-brains.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|arm-rtemseabi4.11           |arm-eabi-gcc
      Known to fail|                            |4.7.0

--- Comment #5 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2011-09-12 09:15:48 UTC ---
It would be nice if this can be fixed for 4.6.2 and 4.7.0.


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (6 preceding siblings ...)
  2011-09-12  9:23 ` sebastian.huber@embedded-brains.de
@ 2011-10-26 17:22 ` jakub at gcc dot gnu.org
  2011-11-16 17:20 ` rearnsha at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-10-26 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.2                       |4.6.3

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-26 17:13:18 UTC ---
GCC 4.6.2 is being released.


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (7 preceding siblings ...)
  2011-10-26 17:22 ` jakub at gcc dot gnu.org
@ 2011-11-16 17:20 ` rearnsha at gcc dot gnu.org
  2011-11-16 18:00 ` rearnsha at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2011-11-16 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-11-16 17:02:52 UTC ---
Author: rearnsha
Date: Wed Nov 16 17:02:44 2011
New Revision: 181416

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181416
Log:
2011-11-16  Richard Earnshaw  <rearnsha@arm.com>
        Bernd Schmidt <bernds@coudesourcery.com>
        Sebastian Huber <sebastian.huber@embedded-brains.de>

    PR target/49641
    * config/arm/arm.c (store_multiple_sequence): Avoid cases where
    the base reg is stored iff compiling for Thumb1.

    * gcc.target/arm/pr49641.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr49641.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (8 preceding siblings ...)
  2011-11-16 17:20 ` rearnsha at gcc dot gnu.org
@ 2011-11-16 18:00 ` rearnsha at gcc dot gnu.org
  2011-11-16 18:23 ` rearnsha at gcc dot gnu.org
  2013-02-19 20:38 ` LpSolit at netscape dot net
  11 siblings, 0 replies; 13+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2011-11-16 18:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-11-16 17:53:31 UTC ---
Author: rearnsha
Date: Wed Nov 16 17:53:28 2011
New Revision: 181418

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181418
Log:
2011-11-16  Richard Earnshaw  <rearnsha@arm.com>
        Bernd Schmidt <bernds@coudesourcery.com>
        Sebastian Huber <sebastian.huber@embedded-brains.de>

    PR target/49641
    * config/arm/arm.c (store_multiple_sequence): Avoid cases where
    the base reg is stored iff compiling for Thumb1.

    * gcc.target/arm/pr49641.c: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/arm/pr49641.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/arm/arm.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (9 preceding siblings ...)
  2011-11-16 18:00 ` rearnsha at gcc dot gnu.org
@ 2011-11-16 18:23 ` rearnsha at gcc dot gnu.org
  2013-02-19 20:38 ` LpSolit at netscape dot net
  11 siblings, 0 replies; 13+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2011-11-16 18:23 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

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

--- Comment #9 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2011-11-16 17:54:31 UTC ---
Fixed.


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

* [Bug target/49641] [4.6 Regression] Wrong code for ARMv4T and stmia
  2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
                   ` (10 preceding siblings ...)
  2011-11-16 18:23 ` rearnsha at gcc dot gnu.org
@ 2013-02-19 20:38 ` LpSolit at netscape dot net
  11 siblings, 0 replies; 13+ messages in thread
From: LpSolit at netscape dot net @ 2013-02-19 20:38 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from jye2 at gcc dot gnu.org 2012-06-08 06:58:32 UTC ---
Author: jye2
Date: Fri Jun  8 06:58:25 2012
New Revision: 188327

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188327
Log:
Backport mainline r179607, r179979, r179980, r181416, r182014
2012-06-08  Joey Ye  <joey.ye@arm.com>

    Backport r182014 from mainline.
    2011-12-05  Kazu Hirata  <kazu@codesourcery.com>

    PR target/51408
    * config/arm/arm.md (*minmax_arithsi): Always require the else
    clause in the MINUS case.

    Backport r181416 from mainline.
    2011-11-16  Richard Earnshaw  <rearnsha@arm.com>
        Bernd Schmidt <bernds@coudesourcery.com>
        Sebastian Huber <sebastian.huber@embedded-brains.de>

    PR target/49641
    * config/arm/arm.c (store_multiple_sequence): Avoid cases where
    the base reg is stored iff compiling for Thumb1.

    Backport r179980 from mainline.
    2011-10-14  David Alan Gilbert  <david.gilbert@linaro.org>

    PR target/48126
    * config/arm/arm.c (arm_output_sync_loop): Move label before barrier.

    Backport r179979 from mainline.
    2011-10-14  David Alan Gilbert  <david.gilbert@linaro.org>

    * config/arm/arm.h (TARGET_HAVE_DMB_MCR): MCR Not available in Thumb1.

    Backport r179607 from mainline.
    2011-10-06  Bernd Schmidt  <bernds@codesourcery.com>

    PR target/49049
    * config/arm/arm.md (arm_subsi3_insn): Lose the last alternative.

Testsuites:
    Backport r182014 from mainline
    2011-12-05  Kazu Hirata  <kazu@codesourcery.com>

    PR target/51408
    * gcc.dg/pr51408.c: New.

    Backport r181416 from mainline
    2011-11-16  Richard Earnshaw  <rearnsha@arm.com>
        Bernd Schmidt <bernds@coudesourcery.com>
        Sebastian Huber <sebastian.huber@embedded-brains.de>

    PR target/49641
    * gcc.target/arm/pr49641.c: New test.

    Backport r179607 from mainline
    2011-10-06  Bernd Schmidt  <bernds@codesourcery.com>

    PR target/49049
    * gcc.c-torture/compile/pr49049.c: New test.


Added:
   
branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.c-torture/compile/pr49049.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.dg/pr51408.c
    branches/ARM/embedded-4_6-branch/gcc/testsuite/gcc.target/arm/pr49641.c
Modified:
    branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm
    branches/ARM/embedded-4_6-branch/gcc/config/arm/arm.c
    branches/ARM/embedded-4_6-branch/gcc/config/arm/arm.h
    branches/ARM/embedded-4_6-branch/gcc/config/arm/arm.md
    branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm


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

end of thread, other threads:[~2013-02-19 20:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-05 12:19 [Bug target/49641] New: [ARM] Wrong code for ARMv4T and stmia sebastian.huber@embedded-brains.de
2011-07-06  6:27 ` [Bug target/49641] " sebastian.huber@embedded-brains.de
2011-07-06  8:32 ` [Bug target/49641] [4.6 Regression] " rearnsha at gcc dot gnu.org
2011-08-01 14:32 ` rguenth at gcc dot gnu.org
2011-08-01 14:42 ` rguenth at gcc dot gnu.org
2011-08-02 13:11 ` bernds at gcc dot gnu.org
2011-08-22 11:10 ` sebastian.huber@embedded-brains.de
2011-09-12  9:23 ` sebastian.huber@embedded-brains.de
2011-10-26 17:22 ` jakub at gcc dot gnu.org
2011-11-16 17:20 ` rearnsha at gcc dot gnu.org
2011-11-16 18:00 ` rearnsha at gcc dot gnu.org
2011-11-16 18:23 ` rearnsha at gcc dot gnu.org
2013-02-19 20:38 ` LpSolit at netscape dot net

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).