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

            Bug ID: 127567
           Summary: Import in local module does not import from the
                    universe of modules
           Product: gcc
           Version: 17.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: ---

It appears that an IMPORT inside a local module will only import symbols from
the outer module and cannot import a module from the universe of external
modules (libraries for example).

Forwarded from the gm2 mailing list:

$ cat badimport.mod 
MODULE badimport;

IMPORT STextIO;

     MODULE interne;

     IMPORT Storage;
     IMPORT SYSTEM;
     EXPORT tt;

     TYPE
         Err = POINTER TO ErrDesc;
         ErrDesc = RECORD
         nr, line, col: INTEGER;
         next: Err
         END;
     VAR
       nextErr: Err;

     PROCEDURE tt;

     BEGIN
         Storage.ALLOCATE(nextErr, SYSTEM.TSIZE(ErrDesc));
     END tt;

     BEGIN

     END interne;

BEGIN
     STextIO.WriteString("Bonjour");
END badimport.

$ gm2 badimport.mod 
badimport.mod:7:13: error: In inner module ‘interne’: unknown symbol ‘Storage’ 
    7 |      IMPORT Storage;
      |             ^~~~~~~
badimport.mod:8:13: error: unknown symbol ‘SYSTEM’ 
    8 |      IMPORT SYSTEM;
      |             ^~~~~~

Reply via email to