public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110808] New: [modules] Internal Compiler Error in check_mergeable_decl
@ 2023-07-25 18:42 mihi32 at gmail dot com
2023-07-25 18:46 ` [Bug c++/110808] " mihi32 at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mihi32 at gmail dot com @ 2023-07-25 18:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110808
Bug ID: 110808
Summary: [modules] Internal Compiler Error in
check_mergeable_decl
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mihi32 at gmail dot com
Target Milestone: ---
Created attachment 55632
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55632&action=edit
Archive with the 3 cpp files that reproduce the error.
// tres.cpp
export module group:tres;
int mul()
{
return 0;
}
// group.cpp
export module group;
export import :tres;
// main.cpp
import group:tres;
int main()
{
return mul();
}
--------------------------------------------------------------------
$ g++-12 -freport-bug -std=c++20 -fmodules-ts tres.cpp group.cpp main.cpp -o
main
main.cpp: In function ‘int main()’:
main.cpp:5:16: internal compiler error: Segmentation fault
5 | return mul();
| ^~~
0xd910e3 crash_signal
../../src/gcc/toplev.cc:322
0x7facc691751f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x76fc34 ovl_iterator::operator*() const
../../src/gcc/cp/cp-tree.h:842
0x76fc34 check_mergeable_decl
../../src/gcc/cp/module.cc:10570
0x792150 trees_in::key_mergeable(int, merge_kind, tree_node*, tree_node*,
tree_node*, tree_node*, bool)
../../src/gcc/cp/module.cc:10805
0x794f14 trees_in::decl_value()
../../src/gcc/cp/module.cc:7921
0x78fa77 trees_in::tree_node(bool)
../../src/gcc/cp/module.cc:9172
0x795b4b module_state::read_cluster(unsigned int)
../../src/gcc/cp/module.cc:14838
0x7960a5 module_state::load_section(unsigned int, binding_slot*)
../../src/gcc/cp/module.cc:18109
0x796237 lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*)
../../src/gcc/cp/module.cc:18801
0x7a3ec4 name_lookup::search_namespace_only(tree_node*)
../../src/gcc/cp/name-lookup.cc:919
0x7a523b name_lookup::search_unqualified(tree_node*, cp_binding_level*)
../../src/gcc/cp/name-lookup.cc:1142
0x7a6fab lookup_name(tree_node*, LOOK_where, LOOK_want)
../../src/gcc/cp/name-lookup.cc:7774
0x7aee01 lookup_name(tree_node*, LOOK_want)
../../src/gcc/cp/name-lookup.h:404
0x7aee01 cp_parser_lookup_name
../../src/gcc/cp/parser.cc:30605
0x7dd045 cp_parser_class_name
../../src/gcc/cp/parser.cc:25693
0x7dd31c cp_parser_type_name
../../src/gcc/cp/parser.cc:20140
0x7ebee0 cp_parser_simple_type_specifier
../../src/gcc/cp/parser.cc:19831
0x7d27fa cp_parser_postfix_expression
../../src/gcc/cp/parser.cc:7573
0x7bc7c6 cp_parser_binary_expression
../../src/gcc/cp/parser.cc:10035
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
-----------------------------------------------------
$ g++-12 -v
Using built-in specs.
COLLECT_GCC=g++-12
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
12.1.0-2ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-12
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-12-sZcx2y/gcc-12-12.1.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-sZcx2y/gcc-12-12.1.0/debian/tmp-gcn/usr
--enable-offload-defaulted --without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (Ubuntu 12.1.0-2ubuntu1~22.04)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/110808] [modules] Internal Compiler Error in check_mergeable_decl
2023-07-25 18:42 [Bug c++/110808] New: [modules] Internal Compiler Error in check_mergeable_decl mihi32 at gmail dot com
@ 2023-07-25 18:46 ` mihi32 at gmail dot com
2024-01-07 10:52 ` cvs-commit at gcc dot gnu.org
2024-01-27 10:23 ` nshead at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mihi32 at gmail dot com @ 2023-07-25 18:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110808
--- Comment #1 from Silviu Vrinceanu <mihi32 at gmail dot com> ---
Created attachment 55633
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55633&action=edit
Archive with preprocessed files *.ii
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/110808] [modules] Internal Compiler Error in check_mergeable_decl
2023-07-25 18:42 [Bug c++/110808] New: [modules] Internal Compiler Error in check_mergeable_decl mihi32 at gmail dot com
2023-07-25 18:46 ` [Bug c++/110808] " mihi32 at gmail dot com
@ 2024-01-07 10:52 ` cvs-commit at gcc dot gnu.org
2024-01-27 10:23 ` nshead at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-07 10:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110808
--- Comment #2 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:7f24446a3cf67d1346c78b4667fba74b73a23302
commit r14-6977-g7f24446a3cf67d1346c78b4667fba74b73a23302
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Fri Nov 24 16:26:43 2023 +1100
c++: Follow module grammar more closely [PR110808]
This patch cleans up the parsing of module-declarations and
import-declarations to more closely follow the grammar defined by the
standard.
For instance, currently we allow declarations like 'import A:B', even
from an unrelated source file (not part of module A), which causes
errors in merging declarations. However, the syntax in [module.import]
doesn't even allow this form of import, so this patch prevents this from
parsing at all and avoids the error that way.
Additionally, we sometimes allow statements like 'import :X' or
'module :X' even when not in a named module, and this causes segfaults,
so we disallow this too.
PR c++/110808
gcc/cp/ChangeLog:
* parser.cc (cp_parser_module_name): Rewrite to handle
module-names and module-partitions independently.
(cp_parser_module_partition): New function.
(cp_parser_module_declaration): Parse module partitions
explicitly. Don't change state if parsing module decl failed.
(cp_parser_import_declaration): Handle different kinds of
import-declarations locally.
gcc/testsuite/ChangeLog:
* g++.dg/modules/part-hdr-1_c.C: Fix syntax.
* g++.dg/modules/part-mac-1_c.C: Likewise.
* g++.dg/modules/mod-invalid-1.C: New test.
* g++.dg/modules/part-8_a.C: New test.
* g++.dg/modules/part-8_b.C: New test.
* g++.dg/modules/part-8_c.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/110808] [modules] Internal Compiler Error in check_mergeable_decl
2023-07-25 18:42 [Bug c++/110808] New: [modules] Internal Compiler Error in check_mergeable_decl mihi32 at gmail dot com
2023-07-25 18:46 ` [Bug c++/110808] " mihi32 at gmail dot com
2024-01-07 10:52 ` cvs-commit at gcc dot gnu.org
@ 2024-01-27 10:23 ` nshead at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-01-27 10:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110808
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nshead at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Target Milestone|--- |14.0
Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org
Keywords|ice-on-valid-code |ice-on-invalid-code
Resolution|--- |FIXED
--- Comment #3 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 14.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-27 10:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 18:42 [Bug c++/110808] New: [modules] Internal Compiler Error in check_mergeable_decl mihi32 at gmail dot com
2023-07-25 18:46 ` [Bug c++/110808] " mihi32 at gmail dot com
2024-01-07 10:52 ` cvs-commit at gcc dot gnu.org
2024-01-27 10:23 ` 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).