https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126288

            Bug ID: 126288
           Summary: -fanalyzer ICE with strtok and malloc
           Product: gcc
           Version: 16.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: zgredder at gmail dot com
  Target Milestone: ---

Created attachment 65067
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65067&action=edit
Preprocessed source code

Input:

=======================
#include <stdlib.h>
#include <string.h>

void ice()
{
        strtok(malloc(1), " ");
}
=======================

$ gcc -S ice.c -fanalyzer
during IPA pass: analyzer
ice.c: In function ‘ice’:
ice.c:6:9: internal compiler error: Segmentation fault
    6 |         strtok(malloc(1), " ");
      |         ^~~~~~~~~~~~~~~~~~~~~~

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/16/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-16.1.1_p20260613/work/gcc-16-20260613/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++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo
16.1.1_p20260613 p3' --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-cet
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.1.1 20260613 (Gentoo 16.1.1_p20260613 p3)

Reply via email to