ifc
ifc copied to clipboard
Apparent stack overflow when parsing simple example
Issue
I have the following example:
export module hello;
import std.core;
export namespace hello {
void say_hello(uint32_t count);
}
which I compile as follows:
cl.exe /W4 /WX /experimental:module /interface /sourceDependencies . /std:c++latest /EHsc /MD /c hello.cpp
If I then try to parse hello.ifc with ifc-printer, I get:
scope-1
\-decl.scope-0 'namespace' hello reachable(initializer)
\-scope-2
\-decl.function-0 'void(decl-type(decl.reference-0))' say_hello home-scope(decl.scope-0) public external
\-chart.unilevel
\-decl.parameter-0 'decl-type(decl.reference-0)'
decl.reference-0 std.core decl.alias-22
[5] 27025 segmentation fault (core dumped) ~/clones/ifc/build/ifc-printer hello.ifc
Inside of gdb, here's what the backtrace looks like:
#0 0x000055555557ad24 in index_like::null<ifc::TypeIndex> (t=<error reading variable: Cannot access memory at address 0x7fffff7feffc>)
at /home/avj/clones/ifc/include/ifc/index-utils.hxx:65
#1 0x00005555555742b8 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:220
#2 0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff1a8, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#3 0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#4 0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#5 0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
#6 0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff358, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#7 0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#8 0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#9 0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
#10 0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff508, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#11 0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#12 0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#13 0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
#14 0x0000555555598d51 in ifc::util::(anonymous namespace)::TypeTranslator::operator() (this=0x7fffff7ff6b8, type=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:139
#15 0x0000555555599371 in ifc::Reader::visit<ifc::util::(anonymous namespace)::TypeTranslator> (this=0x7fffffffbcb0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:187
#16 0x0000555555599468 in ifc::util::get_string_if_possible[abi:cxx11](ifc::util::Loader&, ifc::TypeIndex) (ctx=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/types.cxx:163
#17 0x0000555555574317 in ifc::util::Loader::ref<ifc::TypeIndex> (this=0x7fffffffbc40, index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:223
<snip snip ... goes on forever>
Some specifics
MSVC version
Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33521 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Compiler Passes:
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\cl.exe: Version 19.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1.dll: Version 19.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll: Version 19.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c2.dll: Version 19.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\c1xx.dll: Version 19.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\link.exe: Version 14.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\mspdb140.dll: Version 14.40.33521.0
Z:\home\avj\visual_studio\MSVC\14.40.33521\bin\Hostx64\x64\1033\clui.dll: Version 19.40.33521.0
cl : Command line error D8003 : missing source filename
ifc version
git rev-parse --short HEAD
610da21
Host machine
avj@pika ~/clones/ifc$ uname -a
Linux pika 6.7.7-1-default #1 SMP PREEMPT_DYNAMIC Fri Mar 1 13:51:21 UTC 2024 (1ff84c5) x86_64 x86_64 x86_64 GNU/Linux
avj@pika ~/clones/ifc$ lsb-release -a
LSB Version: n/a
Distributor ID: openSUSE
Description: openSUSE Tumbleweed
Release: 20240302
Codename: n/a
avj@pika ~/clones/ifc$ ldd --version
ldd (GNU libc) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
avj@pika ~/clones/ifc$ gcc --version
gcc (SUSE Linux) 10.4.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.