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

            Bug ID: 57950
           Summary: wrong line numbers in error messages for inline
                    assembler statements
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenb...@fh-soft.de

This was reported as Debian bug #588087 several years ago ...

For error messages concerning inline assembler statements, gcc
counts embedded "\n" characters towards the line number, instead of
actual newlines in the source file, so the error messages refer to
the wrong lines.

Compiling the test program below with "gcc asm-line-number.c" gives
this output:

asm-line-number.c: Assembler messages:
asm-line-number.c:3: Error: no such instruction: `foo'
asm-line-number.c:4: Error: no such instruction: `foo'
asm-line-number.c:8: Error: no such instruction: `foo'

In f1(), both asm errors are in the same source line (3), but gcc
counts them as different because of the "\n" between them.

In f2(), the line number refers to the line (8) which contains
"__asm__" instead of the line (10) with the actual asm code.

static void f1 ()
{
  __asm__ ("foo\nfoo");
}

static void f2 ()
{
  __asm__
    (
      "foo"
    );
}

Reply via email to