ifc icon indicating copy to clipboard operation
ifc copied to clipboard

assertion failure: `byte_offset < contents.size()` 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., vector). These have been generated as follows:

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

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

~/clones/ifc/build/ifc-printer vector.ifc
assertion failure: ``byte_offset < contents.size()'' in file ``/home/avj/clones/ifc/include/ifc/reader.hxx'' at line 32

Inside of gdb, here's what those expressions look like:

Breakpoint 1.12, ifc::Reader::view_entry_at<ifc::symbolic::AliasDecl> (this=0x7fffffffbcd0, offset=(unknown: 0x9e024)) at /home/avj/clones/ifc/include/ifc/reader.hxx:32
32                  IFCASSERT(byte_offset < contents.size());
Missing separate debuginfos, use: zypper install libgcc_s1-debuginfo-14.0.1+git8957-1.2.x86_64 liblzma5-x86-64-v3-debuginfo-5.4.6-1.2.x86_64 libstdc++6-debuginfo-14.0.1+git8957-1.2.x86_64 libtcmalloc4-debuginfo-2.15-1.2.x86_64
(gdb) p byte_offset
$1 = 647204
(gdb) p contents.size()
$2 = 5933456

The following files:

algorithm.ifc
any.ifc
array.ifc
atomic.ifc
bit.ifc
bitset.ifc
codecvt.ifc
deque.ifc
execution.ifc
format.ifc
forward_list.ifc
future.ifc
iosfwd.ifc
list.ifc
locale.ifc
map.ifc
mdspan.ifc
memory_resource.ifc
mutex.ifc
new.ifc
optional.ifc
queue.ifc
ranges.ifc
scoped_allocator.ifc
shared_mutex.ifc
string.ifc
string_view.ifc
syncstream.ifc
thread.ifc
tuple.ifc
typeindex.ifc
variant.ifc
vector.ifc
xmemory.ifc
xutility.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 09:03 aytey