ifc icon indicating copy to clipboard operation
ifc copied to clipboard

assertion failure: `ifc::to_underlying(s) < std::size(table)` when parsing header units for standard headers

Open aytey opened this issue 1 year ago • 0 comments

Issue

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

cl.exe /std:c++latest /exportHeader /headerName:angle /EHsc /MD filesystem

If I then try to parse filesystem.ifc with ifc-printer, I get:

~/clones/ifc/build/ifc-printer filesystem.ifc
assertion failure: ``ifc::to_underlying(s) < std::size(table)'' in file ``/home/avj/clones/ifc/src/sgraph.cxx'' at line 625

Inside of gdb, here's what the stack looks like (I cant print ifc::to_underlying(s)):

#0  ifc::(anonymous namespace)::retrieve_name<ifc::(anonymous namespace)::declsort_table, ifc::DeclSort> (s=ifc::DeclSort::Alias) at /home/avj/clones/ifc/src/sgraph.cxx:625
#1  0x000055555559cb54 in ifc::sort_name (s=ifc::DeclSort::Alias) at /home/avj/clones/ifc/src/sgraph.cxx:632
#2  0x000055555557a072 in ifc::util::to_string<ifc::DeclIndex> (index=...) at /home/avj/clones/ifc/include/ifc/util.hxx:48
#3  0x0000555555571ad5 in ifc::util::load (ctx=..., node=..., index=...) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:399
#4  0x0000555555563f7a in ifc::util::Loader::get<ifc::DeclIndex> (this=0x7fffffffbc50, abstract_index=...) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#5  0x0000555555571602 in ifc::util::load (ctx=..., node=..., index=(unknown: 0x1)) at /home/avj/clones/ifc/src/ifc-dom/decls.cxx:17
#6  0x000055555556291a in ifc::util::Loader::get<ifc::ScopeIndex> (this=0x7fffffffbc50, abstract_index=(unknown: 0x1)) at /home/avj/clones/ifc/include/ifc/dom/node.hxx:239
#7  0x000055555555edf1 in process_ifc (name="filesystem.ifc", options=ifc::util::PrintOptions::None) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:118
#8  0x000055555555efd4 in main (argc=2, argv=0x7fffffffd638) at /home/avj/clones/ifc/src/ifc-printer/main.cxx:143

The following files:

exception.ifc
expected.ifc
filesystem.ifc
fstream.ifc
latch.ifc
numeric.ifc
set.ifc
span.ifc
stack.ifc
stacktrace.ifc
stdexcept.ifc
typeinfo.ifc
xstring.ifc

All crash with the same message.

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.

Issue

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.

aytey avatar Mar 12 '24 10:03 aytey