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

            Bug ID: 105931
           Summary: [12 regression] ICE in cxx_eval_constant_expression
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Created attachment 53122
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53122&action=edit
ccLjLSAH.out.xz (preprocessed source, original)

The reduced test case in bug 105756 now passes with the fix for that bug, but
the original issue when building 0ad (0ad-0.0.25b_alpha) remains:
``
# x86_64-pc-linux-gnu-g++ -o Unified_cpp_js_src_new-regexp0.o -c 
-I/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/dist/system_wrappers
-include
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/config/gcc_hidden.h
-fstack-protector-strong -DDEBUG=1 -DWASM_SUPPORTS_HUGE_MEMORY
-DJS_CACHEIR_SPEW -DJS_STRUCTURED_SPEW -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE
-I/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/new-regexp
-I/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/js/src/new-regexp
-I/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/js/src
-I/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src
-I/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/dist/include
-fPIC -DMOZILLA_CLIENT -include
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/js/src/js-confdefs.h
-Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith
-Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings
-Wno-invalid-offsetof -Wc++2a-compat -Wduplicated-cond -Wimplicit-fallthrough
-Wunused-function -Wunused-variable -Wno-error=maybe-uninitialized
-Wno-error=deprecated-declarations -Wno-error=array-bounds
-Wno-error=coverage-mismatch -Wno-error=free-nonheap-object
-Wno-multistatement-macros -Wno-error=class-memaccess
-Wno-error=deprecated-copy -Wformat -Wformat-security -Wformat-overflow=2
-Wno-noexcept-type -fno-sized-deallocation -fno-aligned-new
-Werror=format-security -Wformat -O2 -pipe -march=native
-fdiagnostics-color=always -frecord-gcc-switches -D_GLIBCXX_ASSERTIONS -ggdb3
-Werror=format-security -Wformat -fno-rtti -ffunction-sections -fdata-sections
-fno-exceptions -fno-math-errno -pthread -pipe -g -fno-omit-frame-pointer
-funwind-tables -fno-strict-aliasing -Werror=format -Wno-shadow -Wno-attributes
 -MD -MP -MF .deps/Unified_cpp_js_src_new-regexp0.o.pp  
Unified_cpp_js_src_new-regexp0.cpp -freport-bug
In file included from
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/dist/include/mozilla/ArrayUtils.h:14,
                 from
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/frontend/TokenStream.h:184,
                 from
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/new-regexp/RegExpAPI.h:12,
                 from
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/new-regexp/RegExpAPI.cpp:11,
                 from Unified_cpp_js_src_new-regexp0.cpp:2:
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/util/TrailingArray.h:
In member function ‘size_t js::TrailingArray::numElements(Offset, Offset)
const’:
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/util/TrailingArray.h:73:41:
internal compiler error: unexpected expression ‘ElemSize’ of kind
template_parm_index
   73 |     MOZ_ASSERT((end - start) % ElemSize == 0);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/dist/include/mozilla/Assertions.h:445:58:
note: in definition of macro ‘MOZ_VALIDATE_ASSERT_CONDITION_TYPE’
  445 |         mozilla::detail::AssertionConditionType<decltype(x)>::isValid,
\
      |                                                          ^
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/dist/include/mozilla/Assertions.h:482:31:
note: in expansion of macro ‘MOZ_ASSERT_HELPER1’
  482 | #define MOZ_ASSERT_GLUE(a, b) a b
      |                               ^
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/build-debug/dist/include/mozilla/Assertions.h:490:5:
note: in expansion of macro ‘MOZ_ASSERT_GLUE’
  490 |     MOZ_ASSERT_GLUE(                                                   
\
      |     ^~~~~~~~~~~~~~~
/var/tmp/portage/games-strategy/0ad-0.0.25b_alpha-r1/work/0ad-0.0.25b-alpha/libraries/source/spidermonkey/mozjs-78.6.0/js/src/util/TrailingArray.h:73:5:
note: in expansion of macro ‘MOZ_ASSERT’
   73 |     MOZ_ASSERT((end - start) % ElemSize == 0);
      |     ^~~~~~~~~~
0x6def33 cxx_eval_constant_expression
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:7587
0x6df310 cxx_eval_outermost_constant_expr
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:7824
0x6e154d potential_constant_expression_1
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:9274
0x6e1ef5 potential_constant_expression_1(tree_node*, bool, bool, bool, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:9550
0x6e1ef5 is_constant_expression(tree_node*)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:9607
0x6e1ef5 is_nondependent_constant_expression(tree_node*)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:9644
0x6e2b04 maybe_constant_value(tree_node*, tree_node*, bool)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/constexpr.cc:8071
0x74e35b fold_for_warn(tree_node*)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/expr.cc:416
0x8c9552 shorten_compare(unsigned int, tree_node**, tree_node**, tree_node**,
tree_code*)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/c-family/c-common.cc:3237
0x889d72 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/typeck.cc:6158
0x6bd96c build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/call.cc:6935
0x88041b build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/typeck.cc:4563
0x81f7e7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/pt.cc:20369
0x82337a instantiate_non_dependent_expr_internal(tree_node*, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/pt.cc:6367
0x82337a instantiate_non_dependent_expr_sfinae(tree_node*, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/pt.cc:6388
0x85eec3 finish_decltype_type(tree_node*, bool, int)
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/semantics.cc:11255
0x7e183f cp_parser_decltype
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/parser.cc:16540
0x7fa3e7 cp_parser_simple_type_specifier
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/parser.cc:19647
0x7d6cbd cp_parser_type_specifier
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/parser.cc:19424
0x7e7eeb cp_parser_type_specifier_seq
       
/usr/src/debug/sys-devel/gcc-12.1.1_p20220611/gcc-12-20220611/gcc/cp/parser.cc:24362
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.
```

```
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/12.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-12.1.1_p20220611/work/gcc-12-20220611/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/12.1.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12.1.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12.1.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/g++-v12
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/12.1.1/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 Hardened
12.1.1_p20220611 p7' --enable-esp --enable-libstdcxx-time
--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-libgomp --disable-libssp --disable-libada --enable-cet
--disable-systemtap --disable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --with-zstd --enable-lto --with-isl
--disable-isl-version-check --enable-default-pie --enable-default-ssp
--with-build-config=bootstrap-cet
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.1 20220611 (Gentoo Hardened 12.1.1_p20220611 p7)
```

Reply via email to