public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
@ 2013-01-25 22:48 akobets at mail dot ru
2013-01-25 23:07 ` [Bug target/56114] " akobets at mail dot ru
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: akobets at mail dot ru @ 2013-01-25 22:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
Bug #: 56114
Summary: x86_64-linux-gnu-gcc generate wrong asm instruction
MOVABS for intel syntax
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: akobets@mail.ru
For example file l.c
long foo2 (void)
{
return *(volatile long*)0xFEE00000;
}
x86_64-linux-gnu-gcc -c -save-temps l.c -O2 -masm=intel
cat l.s
.file "l.c"
.intel_syntax noprefix
.text
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB0:
.cfi_startproc
movabs rax, 4276092928
ret
This is erroneous instruction, because movabs rax, 4276092928 loads immediate
data. This code must be
movabs rax, [4276092928]
with square brackets.
When we try to read 32-bit data from memory, then we get error message
long foo2 (void)
{
return *(volatile int*)0xFEE00000;
}
x86_64-linux-gnu-gcc -c -save-temps l.c -O2 -masm=intel
cat l.s
.file "l.c"
.intel_syntax noprefix
.text
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB0:
.cfi_startproc
movabs eax, 4276092928
cdqe
ret
Because movabs allows load 64-bit only immediate data. Here is GCC loose square
brackets.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
@ 2013-01-25 23:07 ` akobets at mail dot ru
2013-01-26 9:21 ` ubizjak at gmail dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: akobets at mail dot ru @ 2013-01-25 23:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
Alexander Kobets <akobets at mail dot ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |akobets at mail dot ru
--- Comment #1 from Alexander Kobets <akobets at mail dot ru> 2013-01-25 23:06:39 UTC ---
For *(volatile int*)0xFEE00000
x86_64-linux-gnu-gcc -c -save-temps l.c -O2 -masm=intel
l.s: Assembler messages:
l.s:10: Error: operand type mismatch for `movabs'
Alse tried
gcc version 4.7.3 20130119 (prerelease) (GCC)
with same result.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
2013-01-25 23:07 ` [Bug target/56114] " akobets at mail dot ru
@ 2013-01-26 9:21 ` ubizjak at gmail dot com
2013-01-26 14:31 ` akobets at mail dot ru
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-26 9:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
Uros Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2013-01-26
AssignedTo|unassigned at gcc dot |ubizjak at gmail dot com
|gnu.org |
Target Milestone|--- |4.7.3
Ever Confirmed|0 |1
--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-26 09:21:30 UTC ---
Proposed patch:
--cut here--
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 195486)
+++ config/i386/i386.md (working copy)
@@ -2308,7 +2308,7 @@
(match_operand:SWI1248x 1 "nonmemory_operand" "a,r<i>"))]
"TARGET_LP64 && ix86_check_movabs (insn, 0)"
"@
- movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
+ movabs{<imodesuffix>}\t{%1, %P0|%A0, %1}
mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
[(set_attr "type" "imov")
(set_attr "modrm" "0,*")
@@ -2322,7 +2322,7 @@
(mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
"TARGET_LP64 && ix86_check_movabs (insn, 1)"
"@
- movabs{<imodesuffix>}\t{%P1, %0|%0, %P1}
+ movabs{<imodesuffix>}\t{%P1, %0|%0, %A1}
mov{<imodesuffix>}\t{%a1, %0|%0, %a1}"
[(set_attr "type" "imov")
(set_attr "modrm" "0,*")
--cut here--
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
2013-01-25 23:07 ` [Bug target/56114] " akobets at mail dot ru
2013-01-26 9:21 ` ubizjak at gmail dot com
@ 2013-01-26 14:31 ` akobets at mail dot ru
2013-01-26 15:08 ` ubizjak at gmail dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: akobets at mail dot ru @ 2013-01-26 14:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
--- Comment #3 from Alexander Kobets <akobets at mail dot ru> 2013-01-26 14:30:42 UTC ---
(In reply to comment #2)
> Proposed patch:
It is correcting this code, but break another. For example (-mcmodel=large):
--cut here--
long* p1;
long foo2 (void)
{
p1 = (long*)0x123;
return 5;
}
--cut here--
$ x86_64-linux-gnu-gcc -c -mcmodel=large -save-temps l.c -O1 -masm=intel
l.s: Assembler messages:
l.s:10: Error: operand type mismatch for `movabs'
$ cat l.s
.file "l.c"
.intel_syntax noprefix
.text
.globl foo2
.type foo2, @function
foo2:
.LFB0:
.cfi_startproc
mov eax, 291
movabs [OFFSET FLAT:p1], rax
mov ax, 5
ret
.cfi_endproc
.LFE0:
.size foo2, .-foo2
.comm p1,8,8
.ident "GCC: (GNU) 4.7.2"
.section .note.GNU-stack,"",@progbits
The instruction movabs [OFFSET FLAT:p1], rax
before patch was without square brackets and normal compiled.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (2 preceding siblings ...)
2013-01-26 14:31 ` akobets at mail dot ru
@ 2013-01-26 15:08 ` ubizjak at gmail dot com
2013-01-26 16:55 ` akobets at mail dot ru
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-26 15:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
--- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-26 15:08:35 UTC ---
Well, following patch won't break then:
--cut here--
Index: i386.md
===================================================================
--- i386.md (revision 195486)
+++ i386.md (working copy)
@@ -2308,7 +2308,7 @@
(match_operand:SWI1248x 1 "nonmemory_operand" "a,r<i>"))]
"TARGET_LP64 && ix86_check_movabs (insn, 0)"
"@
- movabs{<imodesuffix>}\t{%1, %P0|%P0, %1}
+ movabs{<imodesuffix>}\t{%1, %P0|[%P0], %1}
mov{<imodesuffix>}\t{%1, %a0|%a0, %1}"
[(set_attr "type" "imov")
(set_attr "modrm" "0,*")
@@ -2322,7 +2322,7 @@
(mem:SWI1248x (match_operand:DI 1 "x86_64_movabs_operand" "i,r")))]
"TARGET_LP64 && ix86_check_movabs (insn, 1)"
"@
- movabs{<imodesuffix>}\t{%P1, %0|%0, %P1}
+ movabs{<imodesuffix>}\t{%P1, %0|%0, [%P1]}
mov{<imodesuffix>}\t{%a1, %0|%0, %a1}"
[(set_attr "type" "imov")
(set_attr "modrm" "0,*")
--cut here--
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (3 preceding siblings ...)
2013-01-26 15:08 ` ubizjak at gmail dot com
@ 2013-01-26 16:55 ` akobets at mail dot ru
2013-01-27 13:17 ` uros at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: akobets at mail dot ru @ 2013-01-26 16:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
--- Comment #5 from Alexander Kobets <akobets at mail dot ru> 2013-01-26 16:54:50 UTC ---
(In reply to comment #4)
> Well, following patch won't break then:
Yes, thank you.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (4 preceding siblings ...)
2013-01-26 16:55 ` akobets at mail dot ru
@ 2013-01-27 13:17 ` uros at gcc dot gnu.org
2013-01-27 16:04 ` uros at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2013-01-27 13:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
--- Comment #6 from uros at gcc dot gnu.org 2013-01-27 13:17:00 UTC ---
Author: uros
Date: Sun Jan 27 13:16:54 2013
New Revision: 195494
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195494
Log:
PR target/56114
* config/i386/i386.md (*movabs<mode>_1): Add square brackets around
operand 0 in movabs insn template for -masm=intel asm alternative.
(*movabs<mode>_2): Ditto for operand 1.
testsuite/ChangeLog:
PR target/56114
* gcc.target/i386/pr56114.c: New test.
Added:
trunk/gcc/testsuite/gcc.target/i386/pr56114.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.md
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (5 preceding siblings ...)
2013-01-27 13:17 ` uros at gcc dot gnu.org
@ 2013-01-27 16:04 ` uros at gcc dot gnu.org
2013-01-27 18:37 ` uros at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2013-01-27 16:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
--- Comment #7 from uros at gcc dot gnu.org 2013-01-27 16:03:55 UTC ---
Author: uros
Date: Sun Jan 27 16:03:40 2013
New Revision: 195496
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195496
Log:
Backport from mainline
2013-01-27 Uros Bizjak <ubizjak@gmail.com>
PR target/56114
* config/i386/i386.md (*movabs<mode>_1): Add square brackets around
operand 0 in movabs insn template for -masm=intel asm alternative.
(*movabs<mode>_2): Ditto for operand 1.
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/config/i386/i386.md
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (6 preceding siblings ...)
2013-01-27 16:04 ` uros at gcc dot gnu.org
@ 2013-01-27 18:37 ` uros at gcc dot gnu.org
2013-01-27 18:46 ` ubizjak at gmail dot com
2013-01-27 20:49 ` akobets at mail dot ru
9 siblings, 0 replies; 11+ messages in thread
From: uros at gcc dot gnu.org @ 2013-01-27 18:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
--- Comment #8 from uros at gcc dot gnu.org 2013-01-27 18:37:28 UTC ---
Author: uros
Date: Sun Jan 27 18:37:23 2013
New Revision: 195497
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195497
Log:
Backport from mainline
2013-01-27 Uros Bizjak <ubizjak@gmail.com>
PR target/56114
* config/i386/i386.md (*movabs<mode>_1): Add square brackets around
operand 0 in movabs insn template for -masm=intel asm alternative.
(*movabs<mode>_2): Ditto for operand 1.
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/config/i386/i386.md
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (7 preceding siblings ...)
2013-01-27 18:37 ` uros at gcc dot gnu.org
@ 2013-01-27 18:46 ` ubizjak at gmail dot com
2013-01-27 20:49 ` akobets at mail dot ru
9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2013-01-27 18:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
Uros Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |x86_64
Status|ASSIGNED |RESOLVED
URL|http://sourceware.org/bugzi |http://gcc.gnu.org/ml/gcc-p
|lla/show_bug.cgi?id=15034 |atches/2013-01/msg01278.htm
| |l
See Also| |http://sourceware.org/bugzi
| |lla/show_bug.cgi?id=15034
Resolution| |FIXED
Target Milestone|4.7.3 |4.6.4
--- Comment #9 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-27 18:46:05 UTC ---
Fixed everywhere.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/56114] x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
` (8 preceding siblings ...)
2013-01-27 18:46 ` ubizjak at gmail dot com
@ 2013-01-27 20:49 ` akobets at mail dot ru
9 siblings, 0 replies; 11+ messages in thread
From: akobets at mail dot ru @ 2013-01-27 20:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56114
Alexander Kobets <akobets at mail dot ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |VERIFIED
--- Comment #10 from Alexander Kobets <akobets at mail dot ru> 2013-01-27 20:48:52 UTC ---
Good job.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-01-27 20:49 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
2013-01-25 23:07 ` [Bug target/56114] " akobets at mail dot ru
2013-01-26 9:21 ` ubizjak at gmail dot com
2013-01-26 14:31 ` akobets at mail dot ru
2013-01-26 15:08 ` ubizjak at gmail dot com
2013-01-26 16:55 ` akobets at mail dot ru
2013-01-27 13:17 ` uros at gcc dot gnu.org
2013-01-27 16:04 ` uros at gcc dot gnu.org
2013-01-27 18:37 ` uros at gcc dot gnu.org
2013-01-27 18:46 ` ubizjak at gmail dot com
2013-01-27 20:49 ` akobets at mail dot ru
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).