public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115200] New: [modules] ICE in declare_module() with unclosed namespace scope before module perview
@ 2024-05-22 23:00 nickbegg at gmail dot com
2024-05-24 14:12 ` [Bug c++/115200] " cvs-commit at gcc dot gnu.org
2024-05-24 14:13 ` nshead at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: nickbegg at gmail dot com @ 2024-05-22 23:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115200
Bug ID: 115200
Summary: [modules] ICE in declare_module() with unclosed
namespace scope before module perview
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nickbegg at gmail dot com
Target Milestone: ---
The following invalid code causes gcc to ICE in declare_module() in a GCC debug
build -
/// header.hpp
namespace foo {
// no closing brace
/// honeydew.mpp
module;
#include "header.hpp"
export module honeydew;
///
This assert fires...
void
declare_module (module_state *module, location_t from_loc, bool exporting_p,
tree, cpp_reader *reader)
{
gcc_assert (global_namespace == current_scope ());
///
git 15.0.0 / trunk (revid 1a5e4dd83788ea4c049d354d83ad58a6a3d747e6)
/home/nick/inst/gcc-trunk-debug/bin/g++ -fdiagnostics-color=always -g
-std=gnu++23 -MD -MT CMakeFiles/moduleMin.dir/honeydew.mpp.o -MF
CMakeFiles/moduleMin.dir/honeydew.mpp.o.d -fmodules-ts
-fmodule-mapper=CMakeFiles/moduleMin.dir/honeydew.mpp.o.modmap -MD
-fdeps-format=p1689r5 -x c++ -o CMakeFiles/moduleMin.dir/honeydew.mpp.o -c
/home/nick/src/moduleMin/honeydew.mpp
/home/nick/src/moduleMin/honeydew.mpp:5:23: internal compiler error: in
declare_module, at cp/module.cc:19721
5 | export module honeydew;
| ^
0x7b6211 declare_module(module_state*, unsigned int, bool, tree_node*,
cpp_reader*)
/home/nick/src/gcc.trunk/gcc/cp/module.cc:19721
0xc09156 cp_parser_module_declaration
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:15194
0xc32a7b cp_parser_declaration
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:15640
0xc30f51 cp_parser_toplevel_declaration
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:15707
0xc30f51 cp_parser_declaration_seq_opt
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:15420
0xc313c3 cp_parser_namespace_body
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:22268
0xc313c3 cp_parser_namespace_definition
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:22246
0xc32beb cp_parser_declaration
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:15666
0xc333ea cp_parser_toplevel_declaration
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:15707
0xc333ea cp_parser_translation_unit
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:5284
0xc333ea c_parse_file()
/home/nick/src/gcc.trunk/gcc/cp/parser.cc:51498
0xd81931 c_common_parse_file()
/home/nick/src/gcc.trunk/gcc/c-family/c-opts.cc:1311
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/115200] [modules] ICE in declare_module() with unclosed namespace scope before module perview
2024-05-22 23:00 [Bug c++/115200] New: [modules] ICE in declare_module() with unclosed namespace scope before module perview nickbegg at gmail dot com
@ 2024-05-24 14:12 ` cvs-commit at gcc dot gnu.org
2024-05-24 14:13 ` nshead at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-24 14:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115200
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:dae606a11eb99814e452b49241fa76f7678f53b8
commit r15-824-gdae606a11eb99814e452b49241fa76f7678f53b8
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Fri May 24 00:08:57 2024 +1000
c++/modules: Improve errors for bad module-directives [PR115200]
This fixes an ICE when a module directive is not given at global scope.
Although not explicitly mentioned, it seems implied from [basic.link] p1
and [module.global.frag] that a module-declaration must appear at the
global scope after preprocessing. Apart from this the patch also
slightly improves the errors given when accidentally using a module
control-line in other situations where it is not expected.
PR c++/115200
gcc/cp/ChangeLog:
* parser.cc (cp_parser_error_1): Special-case unexpected module
directives for better diagnostics.
(cp_parser_module_declaration): Check that the module
declaration is at global scope.
(cp_parser_import_declaration): Sync error message with that in
cp_parser_error_1.
gcc/testsuite/ChangeLog:
* g++.dg/modules/mod-decl-1.C: Update error messages.
* g++.dg/modules/mod-decl-6.C: New test.
* g++.dg/modules/mod-decl-7.C: New test.
* g++.dg/modules/mod-decl-8.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/115200] [modules] ICE in declare_module() with unclosed namespace scope before module perview
2024-05-22 23:00 [Bug c++/115200] New: [modules] ICE in declare_module() with unclosed namespace scope before module perview nickbegg at gmail dot com
2024-05-24 14:12 ` [Bug c++/115200] " cvs-commit at gcc dot gnu.org
@ 2024-05-24 14:13 ` nshead at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-24 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115200
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
CC| |nshead at gcc dot gnu.org
Target Milestone|--- |15.0
Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org
--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 15.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-24 14:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 23:00 [Bug c++/115200] New: [modules] ICE in declare_module() with unclosed namespace scope before module perview nickbegg at gmail dot com
2024-05-24 14:12 ` [Bug c++/115200] " cvs-commit at gcc dot gnu.org
2024-05-24 14:13 ` nshead 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).