public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
@ 2013-12-24 14:25 spf_zju at 126 dot com
2013-12-24 14:46 ` [Bug target/59593] " mpolacek at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: spf_zju at 126 dot com @ 2013-12-24 14:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
Bug ID: 59593
Summary: [arm big-endian] using "ldrh" access a immediate
which stored in a memory by word
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: spf_zju at 126 dot com
the C code like this:
short int a = 1;
int test()
{
return 922 * a;
}
compile the C code : arm-eabi-gcc -mbig-endian -O2 -S bar.c -o bar.s
the bar.s like this :
movw r3, #:lower16:.LANCHOR0
movt r3, #:upper16:.LANCHOR0
ldrh r0, [r3,#0]
ldrh r3, .L2
smulbb r0, r0, r3
bx lr
.L3:
.align 2
.L2:
.word 922
The immediate 922 is stored in .L2, in arm big-endian mode ,the memory of .L2
is like this 0x0000039a, so when executing this "ldrh r0, [r3,#0]", the r0 is
zero,so the result is wrong .
also see the disassembly of bar.o :
<test>:
0: e3003000 movw r3, #0
4: e3403000 movt r3, #0
8: e1d300b0 ldrh r0,[r3]
c: e1df30b4 ldrh r3,[pc,#4] ;18
10:e1b00380 smulbb r0,r0,r3
14:e12fff1e bx lr
18:0000039a muleq r0,sl,r3
So the return value of the function test is zero. it is wrong .
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
@ 2013-12-24 14:46 ` mpolacek at gcc dot gnu.org
2014-01-02 15:18 ` rearnsha at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-12-24 14:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Component|c |target
Severity|critical |normal
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
2013-12-24 14:46 ` [Bug target/59593] " mpolacek at gcc dot gnu.org
@ 2014-01-02 15:18 ` rearnsha at gcc dot gnu.org
2014-11-05 17:24 ` rearnsha at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2014-01-02 15:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-01-02
Ever confirmed|0 |1
--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Confirmed. Has gone latent for ARMv7 in gcc-4.8 and later since we now
no-longer create a pool entry for the value.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
2013-12-24 14:46 ` [Bug target/59593] " mpolacek at gcc dot gnu.org
2014-01-02 15:18 ` rearnsha at gcc dot gnu.org
@ 2014-11-05 17:24 ` rearnsha at gcc dot gnu.org
2014-11-19 13:46 ` fyang at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2014-11-05 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fei.yang0953 at gmail dot com
--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
*** Bug 63742 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (2 preceding siblings ...)
2014-11-05 17:24 ` rearnsha at gcc dot gnu.org
@ 2014-11-19 13:46 ` fyang at gcc dot gnu.org
2014-11-20 8:39 ` ramana at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fyang at gcc dot gnu.org @ 2014-11-19 13:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #3 from fyang at gcc dot gnu.org ---
Author: fyang
Date: Wed Nov 19 13:46:16 2014
New Revision: 217772
URL: https://gcc.gnu.org/viewcvs?rev=217772&root=gcc&view=rev
Log:
PR target/59593
* config/arm/arm.md (define_attr "arch"): Add v6t2.
(define_attr "arch_enabled"): Add test for the above.
(*movhi_insn_arch4): Add new alternative.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm.md
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (3 preceding siblings ...)
2014-11-19 13:46 ` fyang at gcc dot gnu.org
@ 2014-11-20 8:39 ` ramana at gcc dot gnu.org
2014-11-27 11:00 ` thopre01 at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ramana at gcc dot gnu.org @ 2014-11-20 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #4 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Author: ramana
Date: Thu Nov 20 08:38:34 2014
New Revision: 217826
URL: https://gcc.gnu.org/viewcvs?rev=217826&root=gcc&view=rev
Log:
Fix missing output formatter.
2014-11-20 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/59593
* config/arm/arm.md (*movhi_insn): Use right formatting
for immediate.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm.md
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (4 preceding siblings ...)
2014-11-20 8:39 ` ramana at gcc dot gnu.org
@ 2014-11-27 11:00 ` thopre01 at gcc dot gnu.org
2014-12-03 13:40 ` fyang at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2014-11-27 11:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #5 from thopre01 at gcc dot gnu.org ---
Author: thopre01
Date: Thu Nov 27 11:00:15 2014
New Revision: 218118
URL: https://gcc.gnu.org/viewcvs?rev=218118&root=gcc&view=rev
Log:
2014-11-27 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
PR target/59593
* config/arm/arm.c (dump_minipool): dispatch to consttable pattern
based on mode size.
* config/arm/arm.md (consttable_1): Move from config/arm/thumb1.md and
make it TARGET_EITHER.
(consttable_2): Move from config/arm/thumb1.md, make it TARGET_EITHER
and move HFmode handling from consttable_4 to it.
(consttable_4): Move HFmode handling to consttable_2 pattern.
* config/arm/thumb1.md (consttable_1): Move to config/arm/arm.md.
(consttable_2): Ditto.
gcc/testsuite/
PR target/59593
* gcc.target/arm/constant-pool.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/arm/constant-pool.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm.c
trunk/gcc/config/arm/arm.md
trunk/gcc/config/arm/thumb1.md
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (5 preceding siblings ...)
2014-11-27 11:00 ` thopre01 at gcc dot gnu.org
@ 2014-12-03 13:40 ` fyang at gcc dot gnu.org
2014-12-04 15:16 ` fyang at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fyang at gcc dot gnu.org @ 2014-12-03 13:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #6 from fyang at gcc dot gnu.org ---
Author: fyang
Date: Wed Dec 3 13:39:56 2014
New Revision: 218314
URL: https://gcc.gnu.org/viewcvs?rev=218314&root=gcc&view=rev
Log:
Backport from mainline
2014-11-20 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/59593
* config/arm/arm.md (*movhi_insn): Use right formatting
for immediate.
2014-11-19 Felix Yang <felix.yang@huawei.com>
Shanyao Chen <chenshanyao@huawei.com>
PR target/59593
* config/arm/arm.md (define_attr "arch"): Add v6t2.
(define_attr "arch_enabled"): Add test for the above.
(*movhi_insn_arch4): Add new alternative.
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/config/arm/arm.md
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (6 preceding siblings ...)
2014-12-03 13:40 ` fyang at gcc dot gnu.org
@ 2014-12-04 15:16 ` fyang at gcc dot gnu.org
2015-03-04 5:51 ` thopre01 at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: fyang at gcc dot gnu.org @ 2014-12-04 15:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #7 from fyang at gcc dot gnu.org ---
Author: fyang
Date: Thu Dec 4 15:15:57 2014
New Revision: 218376
URL: https://gcc.gnu.org/viewcvs?rev=218376&root=gcc&view=rev
Log:
Backport from mainline
2014-11-20 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR target/59593
* config/arm/arm.md (*movhi_insn): Use right formatting
for immediate.
2014-11-19 Felix Yang <felix.yang@huawei.com>
Shanyao Chen <chenshanyao@huawei.com>
PR target/59593
* config/arm/arm.md (define_attr "arch"): Add v6t2.
(define_attr "arch_enabled"): Add test for the above.
(*movhi_insn_arch4): Add new alternative.
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/config/arm/arm.md
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (7 preceding siblings ...)
2014-12-04 15:16 ` fyang at gcc dot gnu.org
@ 2015-03-04 5:51 ` thopre01 at gcc dot gnu.org
2015-03-04 5:57 ` thopre01 at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2015-03-04 5:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #8 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
Author: thopre01
Date: Wed Mar 4 05:51:08 2015
New Revision: 221172
URL: https://gcc.gnu.org/viewcvs?rev=221172&root=gcc&view=rev
Log:
2015-03-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
2014-11-27 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
PR target/59593
* config/arm/arm.c (dump_minipool): dispatch to consttable pattern
based on mode size.
* config/arm/arm.md (consttable_1): Make it TARGET_EITHER.
(consttable_2): Make it TARGET_EITHER and move HFmode handling from
consttable_4 to it.
(consttable_4): Move HFmode handling to consttable_2 pattern.
gcc/testsuite/
PR target/59593
* gcc.target/arm/constant-pool.c: New test.
Added:
branches/gcc-4_9-branch/gcc/testsuite/gcc.target/arm/constant-pool.c
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/config/arm/arm.c
branches/gcc-4_9-branch/gcc/config/arm/arm.md
branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (8 preceding siblings ...)
2015-03-04 5:51 ` thopre01 at gcc dot gnu.org
@ 2015-03-04 5:57 ` thopre01 at gcc dot gnu.org
2015-06-02 6:28 ` wad at infinet dot ru
2015-10-30 1:46 ` thopre01 at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2015-03-04 5:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
--- Comment #9 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
Author: thopre01
Date: Wed Mar 4 05:56:54 2015
New Revision: 221173
URL: https://gcc.gnu.org/viewcvs?rev=221173&root=gcc&view=rev
Log:
2015-03-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
Backport from mainline
2014-11-27 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
PR target/59593
* config/arm/arm.c (dump_minipool): dispatch to consttable pattern
based on mode size.
* config/arm/arm.md (consttable_1): Make it TARGET_EITHER.
(consttable_2): Make it TARGET_EITHER and move HFmode handling from
consttable_4 to it.
(consttable_4): Move HFmode handling to consttable_2 pattern.
gcc/testsuite/
PR target/59593
* gcc.target/arm/constant-pool.c: New test.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gcc.target/arm/constant-pool.c
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/config/arm/arm.c
branches/gcc-4_8-branch/gcc/config/arm/arm.md
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (9 preceding siblings ...)
2015-03-04 5:57 ` thopre01 at gcc dot gnu.org
@ 2015-06-02 6:28 ` wad at infinet dot ru
2015-10-30 1:46 ` thopre01 at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: wad at infinet dot ru @ 2015-06-02 6:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
Andrew <wad at infinet dot ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wad at infinet dot ru
--- Comment #10 from Andrew <wad at infinet dot ru> ---
Same bug int gcc 4.9.2
Command line:
arm-rtems-gcc -S -O2 -mbig-endian testbige.c
File testbige.c:
struct test1_s
{
unsigned short st;
};
struct test1_s f1(void)
{
struct test1_s v = {258};
return v;
}
Generated code:
.cpu arm7tdmi
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 2
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.file "testbige.c"
.text
.align 2
.global f1
.type f1, %function
f1:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldrh r0, .L2 @ movhi
mov r0, r0, asl #16
bx lr
.L3:
.align 2
.L2:
.word 258
.size f1, .-f1
.ident "GCC: (GNU) 4.9.2"
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/59593] [arm big-endian] using "ldrh" access a immediate which stored in a memory by word
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
` (10 preceding siblings ...)
2015-06-02 6:28 ` wad at infinet dot ru
@ 2015-10-30 1:46 ` thopre01 at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2015-10-30 1:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59593
Thomas Preud'homme <thopre01 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |thopre01 at gcc dot gnu.org
Resolution|--- |FIXED
--- Comment #11 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
Fixed in all supported releases.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-10-30 1:46 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-24 14:25 [Bug c/59593] New: [arm big-endian] using "ldrh" access a immediate which stored in a memory by word spf_zju at 126 dot com
2013-12-24 14:46 ` [Bug target/59593] " mpolacek at gcc dot gnu.org
2014-01-02 15:18 ` rearnsha at gcc dot gnu.org
2014-11-05 17:24 ` rearnsha at gcc dot gnu.org
2014-11-19 13:46 ` fyang at gcc dot gnu.org
2014-11-20 8:39 ` ramana at gcc dot gnu.org
2014-11-27 11:00 ` thopre01 at gcc dot gnu.org
2014-12-03 13:40 ` fyang at gcc dot gnu.org
2014-12-04 15:16 ` fyang at gcc dot gnu.org
2015-03-04 5:51 ` thopre01 at gcc dot gnu.org
2015-03-04 5:57 ` thopre01 at gcc dot gnu.org
2015-06-02 6:28 ` wad at infinet dot ru
2015-10-30 1:46 ` thopre01 at gcc dot gnu.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).