public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files
@ 2023-05-29 11:33 admin@tho-otto.de
  2023-06-06 21:52 ` [Bug modula2/110019] " gaius at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: admin@tho-otto.de @ 2023-05-29 11:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110019

            Bug ID: 110019
           Summary: Reported line numbers ar off-by-1 when preprocessing
                    source files
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: admin@tho-otto.de
  Target Milestone: ---

When preprocessing modula sources  with -fcpp, both the line number and the
quoted source line are off-by-1 in error reports.

Compiling eg:

MODULE foo;

BEGIN
  i := 0;
END foo.


gives:

foo.mod:3:3: error: In program module 'foo': unknown symbol 'i'
    3 | BEGIN
      |   ^
foo.mod:4:8: error: the following unknown symbols in module 'foo' were
unresolved: and i
    4 |   i := 0;
      |        ^


Additionally, the "and" in the summary of unresolved symbols is wrong.

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

* [Bug modula2/110019] Reported line numbers ar off-by-1 when preprocessing source files
  2023-05-29 11:33 [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files admin@tho-otto.de
@ 2023-06-06 21:52 ` gaius at gcc dot gnu.org
  2023-06-07  0:19 ` gaius at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-06-06 21:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110019

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-06-06

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Confirmed - thanks for the bug report.

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

* [Bug modula2/110019] Reported line numbers ar off-by-1 when preprocessing source files
  2023-05-29 11:33 [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files admin@tho-otto.de
  2023-06-06 21:52 ` [Bug modula2/110019] " gaius at gcc dot gnu.org
@ 2023-06-07  0:19 ` gaius at gcc dot gnu.org
  2023-06-07  0:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-06-07  0:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110019

Gaius Mulley <gaius at gcc dot gnu.org> changed:

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

--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 55276
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55276&action=edit
Proposed fix

Here is a proposed patch:

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

* [Bug modula2/110019] Reported line numbers ar off-by-1 when preprocessing source files
  2023-05-29 11:33 [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files admin@tho-otto.de
  2023-06-06 21:52 ` [Bug modula2/110019] " gaius at gcc dot gnu.org
  2023-06-07  0:19 ` gaius at gcc dot gnu.org
@ 2023-06-07  0:22 ` cvs-commit at gcc dot gnu.org
  2023-06-07  0:23 ` gaius at gcc dot gnu.org
  2023-07-29 14:16 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-07  0:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110019

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:

https://gcc.gnu.org/g:29c82c6ca929e0f5eccfe038dea71177d814c6b7

commit r14-1588-g29c82c6ca929e0f5eccfe038dea71177d814c6b7
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Wed Jun 7 01:21:19 2023 +0100

    PR modula2/110019 Reported line numbers off by 1 when cpp invoked.

    Fix off by one in m2.flex when the line number is set via cpp.

    gcc/m2/ChangeLog:

            PR modula2/110019
            * gm2-compiler/SymbolKey.mod (SearchAndDo): Reformatted.
            (ForeachNodeDo): Reformatted.
            * gm2-compiler/SymbolTable.mod (AddListify): Join list
            with "," or "and" if more than one word is in the list.
            * m2.flex: Remove -1 from atoi(yytext) line number.

    gcc/testsuite/ChangeLog:

            PR modula2/110019
            * gm2/cpp/fail/cpp-fail.exp: New test.
            * gm2/cpp/fail/foocpp.mod: New test.

    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

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

* [Bug modula2/110019] Reported line numbers ar off-by-1 when preprocessing source files
  2023-05-29 11:33 [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files admin@tho-otto.de
                   ` (2 preceding siblings ...)
  2023-06-07  0:22 ` cvs-commit at gcc dot gnu.org
@ 2023-06-07  0:23 ` gaius at gcc dot gnu.org
  2023-07-29 14:16 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-06-07  0:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110019

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now that the patch has been applied.

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

* [Bug modula2/110019] Reported line numbers ar off-by-1 when preprocessing source files
  2023-05-29 11:33 [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files admin@tho-otto.de
                   ` (3 preceding siblings ...)
  2023-06-07  0:23 ` gaius at gcc dot gnu.org
@ 2023-07-29 14:16 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-29 14:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110019

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Gaius Mulley
<gaius@gcc.gnu.org>:

https://gcc.gnu.org/g:07c1033f003a858f4bfc6bb9e6b7ce67670db974

commit r13-7643-g07c1033f003a858f4bfc6bb9e6b7ce67670db974
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Sat Jul 29 15:16:08 2023 +0100

    PR modula2/110019 Reported line numbers off by 1 when cpp invoked.

    Fix off by one in m2.flex when the line number is set via cpp.

    gcc/m2/ChangeLog:

            PR modula2/110019
            * gm2-compiler/SymbolKey.mod (SearchAndDo): Reformatted.
            (ForeachNodeDo): Reformatted.
            * gm2-compiler/SymbolTable.mod (AddListify): Join list
            with "," or "and" if more than one word is in the list.
            * m2.flex: Remove -1 from atoi(yytext) line number.

    gcc/testsuite/ChangeLog:

            PR modula2/110019
            * gm2/cpp/fail/cpp-fail.exp: New test.
            * gm2/cpp/fail/foocpp.mod: New test.

    (cherry picked from commit 29c82c6ca929e0f5eccfe038dea71177d814c6b7)

    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

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

end of thread, other threads:[~2023-07-29 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29 11:33 [Bug modula2/110019] New: Reported line numbers ar off-by-1 when preprocessing source files admin@tho-otto.de
2023-06-06 21:52 ` [Bug modula2/110019] " gaius at gcc dot gnu.org
2023-06-07  0:19 ` gaius at gcc dot gnu.org
2023-06-07  0:22 ` cvs-commit at gcc dot gnu.org
2023-06-07  0:23 ` gaius at gcc dot gnu.org
2023-07-29 14:16 ` cvs-commit 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).