]> git.ipfire.org Git - thirdparty/gcc.git/commit
a68: fix deduplication of imported modes
authorJose E. Marchesi <jose.marchesi@oracle.com>
Sun, 28 Dec 2025 00:35:35 +0000 (01:35 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Sun, 28 Dec 2025 13:33:19 +0000 (14:33 +0100)
commiteb5da48dd4f854f8607dfa95e20467529a15c606
treea8d220628aff918cf028058ae375e3e8d72a2903
parent5212086d0aa901ffa8e92c001e825767b8fd9f83
a68: fix deduplication of imported modes

The internal global list of modes maintained by the compiler should
not contain two modes that are equivalent.  When importing module
interfaces, the modes in these interfaces should get deduplicated
before being "interned" in the compiler's modes list.  This commit
fixes the deduplication to accommodate the fact that more than one
module interface may be read from a given packet (compilation unit)
and also that multiple interfaces may be imported indirectly via
publicized modules.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68-imports.cc (a68_decode_modes): Do not deduplicate imported
modes here.
(a68_open_packet): Do it here.
* a68-parser-extract.cc (extract_revelation): Recurse into
publicized modules after interning modes in the current module,
not before.

gcc/testsuite/ChangeLog

* algol68/execute/modules/module23bar.a68: New test.
* algol68/execute/modules/module23foo.a68: Likewise.
* algol68/execute/modules/program-23.a68: Likewise.
gcc/algol68/a68-imports.cc
gcc/algol68/a68-parser-extract.cc
gcc/testsuite/algol68/execute/modules/module23bar.a68 [new file with mode: 0644]
gcc/testsuite/algol68/execute/modules/module23foo.a68 [new file with mode: 0644]
gcc/testsuite/algol68/execute/modules/program-23.a68 [new file with mode: 0644]