[Bug inline-asm/57950] wrong line numbers in error messages for inline assembler statements

f.heckenbach@fh-soft.de gcc-bugzilla@gcc.gnu.org
Mon Jul 22 11:44:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57950

--- Comment #4 from Frank Heckenbach <f.heckenbach@fh-soft.de> ---
(In reply to Manuel López-Ibáñez from comment #3)
> (In reply to Andreas Schwab from comment #2)
> > GCC uses the line number of the start of the asm statement, so line 8 is
> > correct.
> 
> "Correct" as "expected" but not as "desired".

And it would only explain the latter messages, not the former ones
reported as lines 3 and 4.

> This is what Clang prints by comparison:
> 
> asm-line-number.c:3:12: error: invalid instruction mnemonic 'foo'
>   __asm__ ("foo\nfoo");
>            ^
> <inline asm>:1:2: note: instantiated into assembly here
>         foo
>         ^~~
> asm-line-number.c:3:18: error: invalid instruction mnemonic 'foo'
>   __asm__ ("foo\nfoo");
>                  ^
> <inline asm>:2:1: note: instantiated into assembly here
> foo
> ^~~
> asm-line-number.c:10:7: error: invalid instruction mnemonic 'foo'
>       "foo"
>       ^
> <inline asm>:1:2: note: instantiated into assembly here
>         foo
>         ^~~
> 3 errors generated.
> 
> It seems difficult to get there without an integrated assembler, but GCC
> could at least provide better locations to GAS (and GAS understand and print
> column numbers), so we could get:
> 
> asm-line-number.c: Assembler messages:
> asm-line-number.c:3:12: Error: no such instruction: `foo'
> asm-line-number.c:3:18: Error: no such instruction: `foo'
> asm-line-number.c:10:7: Error: no such instruction: `foo'
> 
> Any editor worth its salt would jump to the correct line and column in the
> sources.

The clang output is indeed very nice, though to me, the wrong line
numbers (at least in the presence of "\n") are the more serious
problem than the lack of column numbers.


More information about the Gcc-bugs mailing list