Bug 98462 - [modules] ICE when making iomanip module and all modules after it
Summary: [modules] ICE when making iomanip module and all modules after it
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: 11.0
Assignee: Nathan Sidwell
URL:
Keywords:
Depends on:
Blocks: c++-modules
  Show dependency treegraph
 
Reported: 2020-12-28 13:53 UTC by Patrick Kox
Modified: 2024-03-13 13:29 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-01-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Kox 2020-12-28 13:53:58 UTC
With the previous snapshot of gcc-11-20201220 the following command failed: g++ -fmodules-ts -std=c++20 -c -x c++-system-header iostream.

This is solved by the current version (gcc-11-20201227) but now running this command on iomanip fails. And when it does, iostream (and other also fail).

So for example when I do it in the following order only iomanip fails:
g++ -fmodules-ts -std=c++20 -c -x c++-system-header cmath
g++ -fmodules-ts -std=c++20 -c -x c++-system-header cwchar
g++ -fmodules-ts -std=c++20 -c -x c++-system-header iostream
g++ -fmodules-ts -std=c++20 -c -x c++-system-header string
g++ -fmodules-ts -std=c++20 -c -x c++-system-header string_view
g++ -fmodules-ts -std=c++20 -c -x c++-system-header iomanip

but when I execute the command with iomanip before the others they also fail and deleting the entire gcm.cache directory seems to solve this.

The output of the error message is:
$ Modules $ g++ -fmodules-ts -std=c++20 -c -x c++-system-header iomanip 
In file included from /opt/gcc-11/include/c++/11.0.0/bits/functexcept.h:40,
                 from /opt/gcc-11/include/c++/11.0.0/bits/stl_algobase.h:60,
                 from /opt/gcc-11/include/c++/11.0.0/bits/char_traits.h:39,
                 from /opt/gcc-11/include/c++/11.0.0/string:40,
of module /opt/gcc-11/include/c++/11.0.0/string, imported at /opt/gcc-11/include/c++/11.0.0/bits/locale_classes.h:40,
        included from /opt/gcc-11/include/c++/11.0.0/bits/ios_base.h:41,
                 from /opt/gcc-11/include/c++/11.0.0/iomanip:40:
/opt/gcc-11/include/c++/11.0.0/bits/locale_classes.h:461:11: internal compiler error: in duplicate_decls, at cp/decl.c:2022
  461 |           __catch(...)
      |           ^~~~~~~
0x66a2ba duplicate_decls(tree_node*, tree_node*, bool, bool)
	../../gcc/cp/decl.c:2022
0xa38d2e check_module_override
	../../gcc/cp/name-lookup.c:3651
0xa38d2e do_pushdecl
	../../gcc/cp/name-lookup.c:3774
0xa39a21 do_pushdecl
	../../gcc/cp/name-lookup.c:4881
0xa39a21 do_pushdecl_with_scope
	../../gcc/cp/name-lookup.c:4881
0xa39c85 pushdecl_namespace_level(tree_node*, bool)
	../../gcc/cp/name-lookup.c:6245
0xa3ae94 pushdecl_top_level(tree_node*)
	../../gcc/cp/name-lookup.c:8717
0x9bce22 declare_library_fn
	../../gcc/cp/except.c:172
0x9bda0d do_end_catch
	../../gcc/cp/except.c:254
0x9bda0d push_eh_cleanup
	../../gcc/cp/except.c:270
0x9bda0d expand_start_catch_block(tree_node*)
	../../gcc/cp/except.c:408
0xaf66d4 finish_handler_parms(tree_node*, tree_node*)
	../../gcc/cp/semantics.c:1492
0xa7e443 cp_parser_handler
	../../gcc/cp/parser.c:27086
0xa5ece7 cp_parser_handler_seq
	../../gcc/cp/parser.c:27061
0xa5ece7 cp_parser_try_block
	../../gcc/cp/parser.c:27015
0xa5ece7 cp_parser_statement
	../../gcc/cp/parser.c:11654
0xa5ff9d cp_parser_statement_seq_opt
	../../gcc/cp/parser.c:12112
0xa60078 cp_parser_compound_statement
	../../gcc/cp/parser.c:12062
0xa7fe6d cp_parser_implicitly_scoped_statement
	../../gcc/cp/parser.c:13577
0xa5f754 cp_parser_selection_statement
	../../gcc/cp/parser.c:12293
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

and this is the error I get when I (for example) execute the command with iostream:
$ Modules $ g++ -fmodules-ts -std=c++20 -c -x c++-system-header iostream
In file included from /opt/gcc-11/include/c++/11.0.0/bits/functexcept.h:40,
                 from /opt/gcc-11/include/c++/11.0.0/bits/stl_algobase.h:60,
                 from /opt/gcc-11/include/c++/11.0.0/bits/char_traits.h:39,
                 from /opt/gcc-11/include/c++/11.0.0/string:40,
of module /opt/gcc-11/include/c++/11.0.0/string, imported at /opt/gcc-11/include/c++/11.0.0/bits/locale_classes.h:40,
        included from /opt/gcc-11/include/c++/11.0.0/bits/ios_base.h:41,
                 from /opt/gcc-11/include/c++/11.0.0/ios:42,
                 from /opt/gcc-11/include/c++/11.0.0/ostream:38,
                 from /opt/gcc-11/include/c++/11.0.0/iostream:39:
/opt/gcc-11/include/c++/11.0.0/bits/locale_classes.h:461:11: internal compiler error: in duplicate_decls, at cp/decl.c:2022
  461 |           __catch(...)
      |           ^~~~~~~
0x66a2ba duplicate_decls(tree_node*, tree_node*, bool, bool)
	../../gcc/cp/decl.c:2022
0xa38d2e check_module_override
	../../gcc/cp/name-lookup.c:3651
0xa38d2e do_pushdecl
	../../gcc/cp/name-lookup.c:3774
0xa39a21 do_pushdecl
	../../gcc/cp/name-lookup.c:4881
0xa39a21 do_pushdecl_with_scope
	../../gcc/cp/name-lookup.c:4881
0xa39c85 pushdecl_namespace_level(tree_node*, bool)
	../../gcc/cp/name-lookup.c:6245
0xa3ae94 pushdecl_top_level(tree_node*)
	../../gcc/cp/name-lookup.c:8717
0x9bce22 declare_library_fn
	../../gcc/cp/except.c:172
0x9bda0d do_end_catch
	../../gcc/cp/except.c:254
0x9bda0d push_eh_cleanup
	../../gcc/cp/except.c:270
0x9bda0d expand_start_catch_block(tree_node*)
	../../gcc/cp/except.c:408
0xaf66d4 finish_handler_parms(tree_node*, tree_node*)
	../../gcc/cp/semantics.c:1492
0xa7e443 cp_parser_handler
	../../gcc/cp/parser.c:27086
0xa5ece7 cp_parser_handler_seq
	../../gcc/cp/parser.c:27061
0xa5ece7 cp_parser_try_block
	../../gcc/cp/parser.c:27015
0xa5ece7 cp_parser_statement
	../../gcc/cp/parser.c:11654
0xa5ff9d cp_parser_statement_seq_opt
	../../gcc/cp/parser.c:12112
0xa60078 cp_parser_compound_statement
	../../gcc/cp/parser.c:12062
0xa7fe6d cp_parser_implicitly_scoped_statement
	../../gcc/cp/parser.c:13577
0xa5f754 cp_parser_selection_statement
	../../gcc/cp/parser.c:12293
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Patrick Palka 2024-03-13 13:29:23 UTC
Seems fixed even in GCC 11.