Bug 44527 - improve diagnostics in inline assembly
Summary: improve diagnostics in inline assembly
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: inline-asm (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2010-06-13 16:44 UTC by Manuel López-Ibáñez
Modified: 2010-06-13 17:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel López-Ibáñez 2010-06-13 16:44:27 UTC
Testcase:

int foo(int X) {
 __asm__ ("frob    %0" : "+r" (X));
 return X;
}

gcc-4.6:

/var/folders/51/51Qw875vFdGa9KojoIi7Zk+++TM/-Tmp-//ccyXfgfZ.s:11:no such instruction: `frob %eax'

clang:

<inline asm>:1:2: error: unrecognized instruction
        frob    %eax
        ^
t.c:2:11: note: generated from here
 __asm__ ("frob    %0" : "+r" (X));
          ^
1 error generated.
Comment 1 Andrew Pinski 2010-06-13 16:47:38 UTC
Hmm, with a newer binutils we get a better error message:
t.c: Assembler messages:
t.c:2: Error: no such instruction: `frob %eax'
Comment 2 Andrew Pinski 2010-06-13 16:47:55 UTC
GNU assembler (GNU Binutils for Debian) 2.18.0.20080103
Comment 3 Andrew Pinski 2010-06-13 16:49:23 UTC
Now with Apple's as we get the weird error message you pointed out but that is because apple's as does not support the change in line info we output:
# 2 "t.c" 1
        frob    %eax
# 0 "" 2
Comment 4 Manuel López-Ibáñez 2010-06-13 16:59:34 UTC
The column information is wrong.
The diagnostic markers are inconsistent (Error versus error).
This depends on the gnu assembler, which is not the default in many places.

Comment 5 Andrew Pinski 2010-06-13 17:18:27 UTC
>The column information is wrong.

What column information :).

>The diagnostic markers are inconsistent (Error versus error).

Report that to the binutils project.

>This depends on the gnu assembler, which is not the default in many places.
Yes and that is on purpose.  It is up to the assembler to get it right not GCC.

We don't control the assembler and we should not be looking into the inline-asm to report an error except for constraints violations.
Comment 6 Manuel López-Ibáñez 2010-06-13 17:30:12 UTC
This column information:

t.c:2:11: note: generated from here
 __asm__ ("frob    %0" : "+r" (X));
          ^

I am not going to get into a reopen war with you anyway. I am just trying to make a list of the diagnostic issues where LLVM claims superiority to GCC. There are a lot, so I guess one more or less doesn't make much difference.

http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html