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

            Bug ID: 119219
           Summary: ICE on c-c++-common/attr-nonstring-14.c
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

See also
https://inbox.sourceware.org/gcc-regression/20250311125434.ufnik%25haoch...@gnu-skx-1.sc.intel.com/
but reproduced locally.

Note that using the C FE is fine:
```
$ g++ gcc/testsuite/c-c++-common/attr-nonstring-14.c -std=gnu++17 -wrapper
valgrind,-q
==2388414== Invalid read of size 2
==2388414==    at 0xE83409: fold_builtin_n(unsigned long, tree_node*,
tree_node*, tree_node**, int, bool) [clone .isra.0] (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xAED640: cxx_eval_builtin_function_call(constexpr_ctx
const*, tree_node*, tree_node*, value_cat, bool*, bool*) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xAD5E81: cxx_eval_call_expression(constexpr_ctx const*,
tree_node*, value_cat, bool*, bool*) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xAD8C19: cxx_eval_constant_expression(constexpr_ctx const*,
tree_node*, value_cat, bool*, bool*, tree_node**) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xAE62F7: cxx_eval_outermost_constant_expr(tree_node*, bool,
bool, mce_value, bool, tree_node*) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xAEC804: maybe_constant_value(tree_node*, tree_node*,
mce_value) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xB1B7DC: cp_fully_fold(tree_node*, mce_value) [clone
.part.0] (in /usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xB23C16: cp_convert_and_check(tree_node*, tree_node*, int)
(in /usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xA93216: convert_like_internal(conversion*, tree_node*,
tree_node*, int, bool, bool, bool, int) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xA8FA10: build_over_call(z_candidate*, int, int) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xAA3D66: build_new_function_call(tree_node*, vec<tree_node*,
va_gc, vl_embed>**, int) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==    by 0xD31DF1: finish_call_expr(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, bool, int) (in
/usr/libexec/gcc/x86_64-pc-linux-gnu/15/cc1plus)
==2388414==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2388414==
gcc/testsuite/c-c++-common/attr-nonstring-14.c: In function ‘void
test_strcspn()’:
gcc/testsuite/c-c++-common/attr-nonstring-14.c:173:14: internal compiler error:
Segmentation fault
  173 |   T (strcspn (S (0), a3[2]));
      |      ~~~~~~~~^~~~~~~~~~~~~~
gcc/testsuite/c-c++-common/attr-nonstring-14.c:30:25: note: in definition of
macro ‘T’
   30 | #define T(call)   sink (call)
      |                         ^~~~
0x52e0d5f ???
       
/usr/src/debug/sys-libs/glibc-2.41.9999/glibc-2.41.9999/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x52c4546 __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x52c45f5 __libc_start_main_impl
        ../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
```

```

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/15/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-15.0.9999/work/gcc-15.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/15
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/15/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/15/python
--enable-objc-gc
--enable-languages=c,c++,d,go,objc,obj-c++,fortran,ada,cobol,m2,rust
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo Hardened 15.0.9999 p, commit
9e712cac5576ed07beadba86b7f0d9e9dad76f8c' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--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-libada --disable-cet --disable-systemtap --enable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --with-zstd --with-isl
--disable-isl-version-check --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
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.1 20250311 (experimental)
86eb3fb520b2a2026f6816ab51b88180b85d6882 (Gentoo Hardened 15.0.9999 p, commit
9e712cac5576ed07beadba86b7f0d9e9dad76f8c)
```

Reply via email to