Public bug reported:

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.

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: assembly gcc intel

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1560686

Title:
  Invalid assembly is generated when using intel syntax

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1560686/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to