[Bug 1560686] Re: Invalid assembly is generated when using intel syntax
Matthias Klose
doko at ubuntu.com
Wed Mar 30 15:46:29 UTC 2016
It is because ST is a register. To use -masm=intel, one should avoid
using registers, like st, rax, xmm0, .... as variables.
** Changed in: gcc-5 (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1560686
Title:
Invalid assembly is generated when using intel syntax
Status in gcc-5 package in Ubuntu:
Invalid
Bug description:
Invalid assembly code is generated when intel syntax (-masm=intel) is
used and there are any symbols of the same name as CPU register. For
example:
int ST = 42;
int main() {
return ST;
}
Will produce messages like:
/tmp/ccglHDgh.s: Assembler messages:
/tmp/ccglHDgh.s:21: Error: invalid use of register
The problem is that GCC will generate nonsense like that:
mov eax, DWORD PTR ST[rip]
In case of such trivial example, it is very easy to find what the
problem is but it can be really tricky to find the cause in larger
projects. I expect that the compiler should at least generate some
clear warning that using such names can cause problems.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1560686/+subscriptions
More information about the foundations-bugs
mailing list