Bug 5034 - Error: `QWORD PTR __CTOR_END__-8[rip]' is not a valid base/index expression
Summary: Error: `QWORD PTR __CTOR_END__-8[rip]' is not a valid base/index expression
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-14 10:07 UTC by Rask Ingemann Lambertsen
Modified: 2007-09-28 10:43 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rask Ingemann Lambertsen 2007-09-14 10:07:35 UTC
The following is rejected by gas:

.intel_syntax noprefix
mov     rax, QWORD PTR __CTOR_END__-8[rip]

These equivalent instructions are accepted by gas as expected:
mov     rax, QWORD PTR __CTOR_END__+-8[rip]
mov     rax, QWORD PTR -8+__CTOR_END__[rip]
mov     rax, QWORD PTR __CTOR_END__[rip-8]

Ofcourse the variant that gas rejects is the one which GCC emits. :-(
Comment 1 H.J. Lu 2007-09-15 22:10:08 UTC
Fixed by

http://sourceware.org/ml/binutils/2007-09/msg00202.html
Comment 2 H.J. Lu 2007-09-17 14:48:28 UTC
According to

http://sourceware.org/ml/binutils/2007-09/msg00213.html

it is invalid MASM assembly code. The fix has been reverted.
Comment 3 Rask Ingemann Lambertsen 2007-09-28 10:43:43 UTC
There's a bug in GCC with %rip relative adressing and -masm=intel. I'm fixing
that, which means GCC will output one of the supported address forms, just as
with any other register:

mov     rax, QWORD PTR __CTOR_END__[rip-8]

So I'm closing this bug as invalid.