public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE
@ 2024-05-09  9:06 gaius at gcc dot gnu.org
  2024-05-09  9:06 ` [Bug modula2/115003] " gaius at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-05-09  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115003
           Summary: exporting a symbol to outer scope with a name clash
                    causes ICE
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

As reported on the gm2 mailing list, the following program causes an ICE:

MODULE Test;
(*
 * Produces internal compiler error
 * Inside SymbolTable.GetScope, GetPsym() returns an unexpected token.
 *)

TYPE CardType = CARDINAL;

 MODULE Inside;

 EXPORT CardType;

 END Inside;

END Test.

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

* [Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE
  2024-05-09  9:06 [Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE gaius at gcc dot gnu.org
@ 2024-05-09  9:06 ` gaius at gcc dot gnu.org
  2024-05-09  9:13 ` gaius at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-05-09  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-05-09

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Confirmed.

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

* [Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE
  2024-05-09  9:06 [Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE gaius at gcc dot gnu.org
  2024-05-09  9:06 ` [Bug modula2/115003] " gaius at gcc dot gnu.org
@ 2024-05-09  9:13 ` gaius at gcc dot gnu.org
  2024-05-09 18:36 ` cvs-commit at gcc dot gnu.org
  2024-05-09 18:36 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-05-09  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

The scope was an unknown symbol which was not in the case list within
SymbolTable.GetScope.
This patch adds a missing case clause allowing the compiler to recover.

$ gm2 Test.mod 
Test.mod:11:9: error: symbol ‘CardType’ is already declared in this scope, use
a different name or remove the declaration
   11 |  EXPORT CardType;
      |         ^~~~~~~~
Test.mod:7:17: error: symbol ‘CardType’ also declared in this module
    7 | TYPE CardType = CARDINAL;
      |                 ^~~~~~~~

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

* [Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE
  2024-05-09  9:06 [Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE gaius at gcc dot gnu.org
  2024-05-09  9:06 ` [Bug modula2/115003] " gaius at gcc dot gnu.org
  2024-05-09  9:13 ` gaius at gcc dot gnu.org
@ 2024-05-09 18:36 ` cvs-commit at gcc dot gnu.org
  2024-05-09 18:36 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-09 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC 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:bc5afdf14ccf8375f7fb3de2be1121aaf550f8aa

commit r15-349-gbc5afdf14ccf8375f7fb3de2be1121aaf550f8aa
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Thu May 9 19:35:20 2024 +0100

    PR modula2/115003 exporting a symbol to outer scope with a name clash
causes ICE

    An ICE will occur if an unknown symbol is exported and causes a name
    clash.  The error mechanism attempts to find the scope of an unknown
    symbol.  This patch adds a missing case clause to GetScope and returns
    NulSym if the scope is an unknown symbol.

    gcc/m2/ChangeLog:

            PR modula2/115003
            * gm2-compiler/SymbolTable.mod (GetScope): Add UndefinedSym
            case clause and return NulSym.

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

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

* [Bug modula2/115003] exporting a symbol to outer scope with a name clash causes ICE
  2024-05-09  9:06 [Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE gaius at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-09 18:36 ` cvs-commit at gcc dot gnu.org
@ 2024-05-09 18:36 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-05-09 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

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] 5+ messages in thread

end of thread, other threads:[~2024-05-09 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-09  9:06 [Bug modula2/115003] New: exporting a symbol to outer scope with a name clash causes ICE gaius at gcc dot gnu.org
2024-05-09  9:06 ` [Bug modula2/115003] " gaius at gcc dot gnu.org
2024-05-09  9:13 ` gaius at gcc dot gnu.org
2024-05-09 18:36 ` cvs-commit at gcc dot gnu.org
2024-05-09 18:36 ` gaius 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).