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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(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".

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.

Reply via email to