[Bug 1560686] [NEW] Invalid assembly is generated when using intel syntax

Hubert pvc.meheha at gmail.com
Tue Mar 22 21:12:12 UTC 2016


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
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:
  New

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