public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/57950] New: wrong line numbers in error messages for inline assembler statements
@ 2013-07-21 19:18 f.heckenbach@fh-soft.de
  2013-07-21 20:21 ` [Bug inline-asm/57950] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: f.heckenbach@fh-soft.de @ 2013-07-21 19:18 UTC (permalink / raw)
  To: gcc-bugs

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.heckenbach@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"
    );
}


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-09-14  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-21 19:18 [Bug inline-asm/57950] New: wrong line numbers in error messages for inline assembler statements f.heckenbach@fh-soft.de
2013-07-21 20:21 ` [Bug inline-asm/57950] " pinskia at gcc dot gnu.org
2013-07-21 20:23 ` schwab@linux-m68k.org
2013-07-22 11:28 ` manu at gcc dot gnu.org
2013-07-22 12:43 ` schwab@linux-m68k.org
2013-07-22 13:05 ` manu at gcc dot gnu.org
2013-07-22 18:27 ` manu at gcc dot gnu.org
2013-07-22 20:24 ` manu at gcc dot gnu.org
2013-07-22 21:39 ` schwab@linux-m68k.org
2021-09-14  9:46 ` [Bug c/57950] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).