Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid string construction in ifc::util::(anonymous namespace)::ExprLoader::operator() #65

Open
aytey opened this issue Mar 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aytey
Copy link
Contributor

aytey commented Mar 12, 2024

Issue

I am trying to print (using ifc-printer) the "header unit" IFCs for some standard headers (e.g., vector). These have been generated as follows:

cl.exe /std:c++latest /exportHeader /headerName:angle /EHsc /MD ${NAME}

For the following files:

chrono.ifc
compare.ifc
concepts.ifc
coroutine.ifc
cstddef.ifc
initializer_list.ifc
iterator.ifc
numbers.ifc
random.ifc
ratio.ifc
type_traits.ifc
xlocinfo.ifc

They all crash with the following stack trace:

#0  0x00007ffff756f5ed in __strlen_avx2 () from /lib64/libc.so.6
#1  0x000055555555f201 in std::char_traits<char>::length (__s=0x5556440f0740 <error: Cannot access memory at address 0x5556440f0740>) at /usr/include/c++/13/bits/char_traits.h:399
#2  0x0000555555560e92 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> > (this=0x55555649a820, __s=0x5556440f0740 <error: Cannot access memory at address 0x5556440f0740>, __a=...) at /usr/include/c++/13/bits/basic_string.h:648
#3  0x0000555555592ca7 in std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::pair<char const (&) [7], char const*> (this=0x55555649a800, __x=..., __y=@0x7fffffffafc8: 0x5556440f0740 <error: Cannot access memory at address 0x5556440f0740>) at /usr/include/c++/13/bits/stl_pair.h:317
#4  0x0000555555592850 in std::construct_at<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const (&) [7], char const*> (__location=0x55555649a800) at /usr/include/c++/13/bits/stl_construct.h:97
#5  0x00005555555922c5 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::construct<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const (&) [7], char const*> (__p=0x55555649a800, __a=...) at /usr/include/c++/13/bits/alloc_traits.h:540
#6  std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
> > > >::_M_construct_node<char const (&) [7], char const*> (this=0x555556499810, __node=0x55555649a7e0) at /usr/include/c++/13/bits/stl_tree.h:597
#7  0x0000555555591bea in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_create_node<char const (&) [7], char const*> (this=0x555556499810) at /usr/include/c++/13/bits/stl_tree.h:614
#8  0x00005555555917cc in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_Auto_node::_Auto_node<char const (&) [7], char const*> (this=0x7fffffffaea0, __t=...) at /usr/include/c++/13/bits/stl_tree.h:1637
#9  0x000055555558ebdc in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_emplace_unique<char const (&) [7], char const*> (this=0x555556499810) at /usr/include/c++/13/bits/stl_tree.h:2434
#10 0x000055555558c6f5 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::emplace<char const (&) [7], char const*> (this=0x555556499810) at /usr/include/c++/13/bits/stl_map.h:608
#11 0x000055555558881b in ifc::util::(anonymous namespace)::ExprLoader::operator() (this=0x7fffffffb0c0, expr=...) at /home/avj/clones/ifc/src/ifc-dom/exprs.cxx:200
#12 0x00005555555899ea in ifc::Reader::visit<ifc::util::(anonymous namespace)::ExprLoader> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:330
#13 0x0000555555589f5e in ifc::util::load (ctx=..., node=..., expr=...) at /home/avj/clones/ifc/src/ifc-dom/exprs.cxx:355
#14 0x0000555555589fb4 in ifc::util::load (ctx=..., node=..., index=2275) at /home/avj/clones/ifc/src/ifc-dom/exprs.cxx:360
#15 0x000055555558157c in ifc::util::Loader::get<ifc::symbolic::DefaultIndex> (this=0x7fffffffbc60, abstract_index=2275) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#16 0x000055555557c5d2 in ifc::util::load_initializer<ifc::symbolic::DefaultIndex> (ctx=..., n=..., index=2275) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:47
#17 0x0000555555576239 in ifc::util::load_common_props<ifc::symbolic::ParameterDecl> (ctx=..., n=..., val=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:134
#18 0x00005555555725c4 in ifc::util::DeclLoader::operator() (this=0x7fffffffb340, param=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:210
#19 0x0000555555573953 in ifc::Reader::visit_with_index<ifc::util::DeclLoader&> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:255
#20 0x0000555555571b20 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:401
#21 0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc60, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#22 0x000055555556fe94 in ifc::util::Loader::get<ifc::symbolic::ParameterDecl> (this=0x7fffffffbc60, decl=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:255
#23 0x000055555556f522 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/charts.cxx:27
#24 0x000055555556f3fb in ifc::util::Loader::try_get (this=0x7fffffffbc60, index=...) at /home/avj/clones/ifc/src/ifc-dom/charts.cxx:15
#25 0x00005555555729c7 in ifc::util::DeclLoader::operator() (this=0x7fffffffb640, decl_index=..., decl=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:278
#26 0x0000555555573ac6 in ifc::Reader::visit_with_index<ifc::util::DeclLoader&> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:262
#27 0x0000555555571b20 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:401
#28 0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc60, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#29 0x0000555555571602 in ifc::util::load (ctx=..., node=..., index=(unknown: 0x2)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:17
#30 0x000055555556291a in ifc::util::Loader::get<ifc::ScopeIndex> (this=0x7fffffffbc60, abstract_index=(unknown: 0x2)) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#31 0x000055555557c32e in ifc::util::load_initializer<ifc::ScopeIndex> (ctx=..., n=..., index=(unknown: 0x2)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:47
#32 0x000055555557576f in ifc::util::load_common_props<ifc::symbolic::ScopeDecl> (ctx=..., n=..., val=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:134
#33 0x0000555555572505 in ifc::util::DeclLoader::operator() (this=0x7fffffffba90, decl_index=..., udt=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:193
#34 0x00005555555739f2 in ifc::Reader::visit_with_index<ifc::util::DeclLoader&> (this=0x7fffffffbcd0, index=..., f=...) at /home/avj/clones/ifc/include/ifc/reader.hxx:258
#35 0x0000555555571b20 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:401
#36 0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc60, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#37 0x0000555555571602 in ifc::util::load (ctx=..., node=..., index=(unknown: 0x1)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:17
#38 0x000055555556291a in ifc::util::Loader::get<ifc::ScopeIndex> (this=0x7fffffffbc60, abstract_index=(unknown: 0x1)) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#39 0x000055555555edf1 in process_ifc (name="xlocinfo.ifc", options=ifc::util::PrintOptions::None) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:118
#40 0x000055555555efd4 in main (argc=2, argv=0x7fffffffd648) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:143

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.
@GabrielDosReis GabrielDosReis added the bug Something isn't working label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants