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

--- Comment #3 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 65682
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65682&action=edit
Proposed patch to fix the  local import of a defimp module

$ cat tinygoodimport.mod
MODULE tinygoodimport ;

IMPORT ASCII ;

   MODULE inner ;
   IMPORT ASCII ;
   VAR
      foo: CHAR ;
   BEGIN
      foo := ASCII.nul
   END inner ;

BEGIN
END tinygoodimport.

$ gm2 tinygoodimport.mod
$

correctly compiles without any error message issued.


$ cat tinybadimport.mod
MODULE tinybadimport ;

   MODULE inner ;
   IMPORT ASCII ;
   VAR
      foo: CHAR ;
   BEGIN
      foo := ASCII.nul ;
   END inner ;

BEGIN
END tinybadimport.

$ gm2  tinybadimport.mod
tinybadimport.mod:4:11: error: In inner module ‘inner’: unknown symbol ‘ASCII’ 
    4 |    IMPORT ASCII ;
      |           ^~~~~

correctly issues an error as the inner module cannot directly import a defimp
module.

Reply via email to