https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124477
Bug ID: 124477
Summary: ICE in nonnull_arg_p in call to memset via std module
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: robert.broglia at gmail dot com
Target Milestone: ---
I've finished adapting my library to use C++ modules but am running into an ICE
when compiling my release build in a file that calls std::memcpy. It doesn't
happen if no optimization flags are passed or if <cstring> is included before
importing the std module. I stripped down the particular file to the minimum
and here is the bug report output:
// Target: x86_64-pc-linux-gnu
// Configured with:
/var/tmp/portage/sys-devel/gcc-16.0.9999/work/gcc-16.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/16
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/16/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/16
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/16/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/16/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/16/python
--enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror
--with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=yes,extra
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 16.0.9999 p,
commit 9f776b2cbc66523f9c3ca137661dfad4ea68a6c6' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch
--enable-linker-build-id --disable-libada --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--with-tls=gnu2 --enable-multilib --with-multilib-list=m32,m64
--disable-fixed-point --enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--enable-cet --disable-systemtap --disable-valgrind-annotations
--disable-valgrind-interop --disable-vtable-verify --disable-libvtv --with-zstd
--without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1
--with-build-config='bootstrap-O3 bootstrap-lto bootstrap-cet'
// Thread model: posix
// Supported LTO compression algorithms: zlib zstd
// gcc version 16.0.1 20260312 (experimental)
ad0132a8690ef04d83e44aafb45451010e1fc997 (Gentoo 16.0.9999 p, commit
9f776b2cbc66523f9c3ca137661dfad4ea68a6c6)
//
// during GIMPLE pass: ealias
// /home/robert/projects/imagine/src/thread/thread.cc: In function ‘memset’:
// /home/robert/projects/imagine/src/thread/thread.cc:21:9: internal compiler
error: in nonnull_arg_p, at tree.cc:14919
// 21 | }
// | ^
// 0x555557099a1a internal_error(char const*, ...)
// ???:0
// 0x5555570a16f6 fancy_abort(char const*, int, char const*)
// ???:0
// 0x55555766237d compute_may_aliases()
// ???:0
// -quiet -MD CMakeFiles/imagine.dir/Release/src/thread/thread.cc.d -MF
CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o.d -MT
CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o -D_GNU_SOURCE
-D_REENTRANT -D CMAKE_INTDIR="Release" -D _GNU_SOURCE -D NDEBUG -D _REENTRANT
/home/robert/projects/imagine/src/thread/thread.cc
-fdeps-file=CMakeFiles/imagine.dir/Release/src/thread/thread.cc.ddi
-fdeps-target=CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o -quiet
-dumpdir CMakeFiles/imagine.dir/Release/src/thread/ -dumpbase thread.cc.cc
-dumpbase-ext .cc -m64 -march=x86-64-v3 -mtune=generic -mtls-dialect=gnu2 -gz
-O3 -Wall -Wextra -Wdisabled-optimization -Werror -std=gnu++26 -fmax-errors=15
-fno-threadsafe-statics -fvisibility=hidden -fno-semantic-interposition
-ffunction-sections -fdata-sections -ffast-math -flto -fno-stack-protector
-fno-asynchronous-unwind-tables -fomit-frame-pointer
-fvisibility-inlines-hidden -fmodules
-fmodule-mapper=CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o.modmap
-fdeps-format=p1689r5 -freport-bug -foffload-options=-fno-stack-protector
-fcf-protection -foffload-options=-fcf-protection=none -o - -frandom-seed=0
-fdump-noaddr
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://bugs.gentoo.org/> for instructions.
// /usr/libexec/gcc/x86_64-pc-linux-gnu/16/cc1plus -quiet -MD
CMakeFiles/imagine.dir/Release/src/thread/thread.cc.d -MF
CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o.d -MT
CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o -D_GNU_SOURCE
-D_REENTRANT -D CMAKE_INTDIR="Release" -D _GNU_SOURCE -D NDEBUG -D _REENTRANT
/home/robert/projects/imagine/src/thread/thread.cc
-fdeps-file=CMakeFiles/imagine.dir/Release/src/thread/thread.cc.ddi
-fdeps-target=CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o -quiet
-dumpdir CMakeFiles/imagine.dir/Release/src/thread/ -dumpbase thread.cc.cc
-dumpbase-ext .cc -m64 -march=x86-64-v3 -mtune=generic -mtls-dialect=gnu2 -gz
-O3 -Wall -Wextra -Wdisabled-optimization -Werror -std=gnu++26 -fmax-errors=15
-fno-threadsafe-statics -fvisibility=hidden -fno-semantic-interposition
-ffunction-sections -fdata-sections -ffast-math -flto -fno-stack-protector
-fno-asynchronous-unwind-tables -fomit-frame-pointer
-fvisibility-inlines-hidden -fmodules
-fmodule-mapper=CMakeFiles/imagine.dir/Release/src/thread/thread.cc.o.modmap
-fdeps-format=p1689r5 -freport-bug -foffload-options=-fno-stack-protector
-fcf-protection -foffload-options=-fcf-protection=none -o - -frandom-seed=0
-fdump-noaddr
# 0 "/home/robert/projects/imagine/src/thread/thread.cc"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3
# 0 "<command-line>" 2
# 1 "/home/robert/projects/imagine/src/thread/thread.cc"
# 16 "/home/robert/projects/imagine/src/thread/thread.cc"
import std;
void foo(void* data)
{
std::memset(data, 0xFF, 4);
}