public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr
@ 2022-06-16 13:05 doko at gcc dot gnu.org
  2022-06-16 13:41 ` [Bug c++/106001] [12/13 " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: doko at gcc dot gnu.org @ 2022-06-16 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106001
           Summary: [12 Regression] ICE: nexpected expression
                    'static_cast<char>(1)' of kind static_cast_expr
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

seen with the gcc-12 branch 20220616 on x86_64-linux-gnu, building the spoa
package:

$ cat simd_alignment_engine_dispatch.ii
template <int> void _mmxxx_prefix_max() {
  char simde__tmp_a__0 =
      __builtin_shufflevector(simde__tmp_a__0, 0, static_cast<char>(1))

$ LANG=C g++ -c -msse2 -O0 -std=c++11 simd_alignment_engine_dispatch.ii
simd_alignment_engine_dispatch.ii: In function 'void _mmxxx_prefix_max()':
simd_alignment_engine_dispatch.ii:3:71: internal compiler error: unexpected
expression 'static_cast<char>(1)' of kind static_cast_expr
    3 |       __builtin_shufflevector(simde__tmp_a__0, 0, static_cast<char>(1))
      |                                                                       ^
0x6d9b71 cxx_eval_constant_expression
        ../../src/gcc/cp/constexpr.cc:7587
0x6d9ec0 cxx_eval_outermost_constant_expr
        ../../src/gcc/cp/constexpr.cc:7824
0x6dd267 maybe_constant_value(tree_node*, tree_node*, bool)
        ../../src/gcc/cp/constexpr.cc:8103
0x867381 build_x_shufflevector(unsigned int, vec<tree_node*, va_gc, vl_embed>*,
int)
        ../../src/gcc/cp/typeck.cc:6337
0x7cf33e cp_parser_postfix_expression
        ../../src/gcc/cp/parser.cc:7496
0x7b8096 cp_parser_binary_expression
        ../../src/gcc/cp/parser.cc:10035
0x7b889e cp_parser_assignment_expression
        ../../src/gcc/cp/parser.cc:10339
0x7ba3c9 cp_parser_constant_expression
        ../../src/gcc/cp/parser.cc:10642
0x7ba461 cp_parser_initializer_clause
        ../../src/gcc/cp/parser.cc:25223
0x7bd44c cp_parser_initializer
        ../../src/gcc/cp/parser.cc:25163
0x7eaf5f cp_parser_init_declarator
        ../../src/gcc/cp/parser.cc:22773
0x7c73b8 cp_parser_simple_declaration
        ../../src/gcc/cp/parser.cc:15280
0x7c8fe0 cp_parser_declaration_statement
        ../../src/gcc/cp/parser.cc:14361
0x7c97cc cp_parser_statement
        ../../src/gcc/cp/parser.cc:12446
0x7ca6ed cp_parser_statement_seq_opt
        ../../src/gcc/cp/parser.cc:12850
0x7ca79f cp_parser_compound_statement
        ../../src/gcc/cp/parser.cc:12802
0x7e91c3 cp_parser_function_body
        ../../src/gcc/cp/parser.cc:25069
0x7e91c3 cp_parser_ctor_initializer_opt_and_function_body
        ../../src/gcc/cp/parser.cc:25120
0x7ea30e cp_parser_function_definition_after_declarator
        ../../src/gcc/cp/parser.cc:31252
0x7eb376 cp_parser_function_definition_from_specifiers_and_declarator
        ../../src/gcc/cp/parser.cc:31168
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.


// Target: x86_64-linux-gnu
// Configured with: ../src/configure -v --with-pkgversion='Debian 12.1.0-4'
--with-bugurl=file:/
//usr/share/doc/gcc-12/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --p
refix=/usr --with-gcc-major-version-only --program-suffix=-12
--program-prefix=x86_64-linux-gnu-
 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --ena
ble-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug -
-enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable
-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checki
ng=release --with-target-system-zlib=auto --enable-objc-gc=auto
--enable-multiarch --disable-wer
ror --enable-cet --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-m
ultilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-12-8ErGg2/gcc-12-12.1
.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-8ErGg2/gcc-12-12.1.0/debian/tmp-gcn/usr
--en
able-offload-defaulted --without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu 
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
// Thread model: posix
// Supported LTO compression algorithms: zlib zstd
// gcc version 12.1.0 (Debian 12.1.0-4)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106001] [12/13 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr
  2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
@ 2022-06-16 13:41 ` mpolacek at gcc dot gnu.org
  2022-06-16 17:30 ` [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935 jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-16 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|[12 Regression] ICE:        |[12/13 Regression] ICE:
                   |nexpected expression        |nexpected expression
                   |'static_cast<char>(1)' of   |'static_cast<char>(1)' of
                   |kind static_cast_expr       |kind static_cast_expr
                 CC|                            |mpolacek at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2022-06-16
   Target Milestone|---                         |12.2

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r12-1128-gef8176e0fac935

commit ef8176e0fac935c095cc39f4ecdfd43cdb8cb3f3
Author: Richard Biener <rguenther@suse.de>
Date:   Fri May 21 11:33:30 2021 +0200

    c++/88601 - [C/C++] __builtin_shufflevector support

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935
  2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
  2022-06-16 13:41 ` [Bug c++/106001] [12/13 " mpolacek at gcc dot gnu.org
@ 2022-06-16 17:30 ` jakub at gcc dot gnu.org
  2022-06-16 17:51 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-16 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually valid testcase:

typedef int V __attribute__((vector_size (2 * sizeof (int))));

template <int>
void
foo ()
{
  V v {};
  v = __builtin_shufflevector (v, v, static_cast<char>(1),
static_cast<char>(0));
}

void
bar ()
{
  foo <0> ();
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935
  2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
  2022-06-16 13:41 ` [Bug c++/106001] [12/13 " mpolacek at gcc dot gnu.org
  2022-06-16 17:30 ` [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935 jakub at gcc dot gnu.org
@ 2022-06-16 17:51 ` jakub at gcc dot gnu.org
  2022-06-17 15:41 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-16 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 53155
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53155&action=edit
gcc13-pr106001.patch

Untested fix.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935
  2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-06-16 17:51 ` jakub at gcc dot gnu.org
@ 2022-06-17 15:41 ` cvs-commit at gcc dot gnu.org
  2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
  2022-06-20  9:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-17 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a284fadcce8ef443cc3cc047a8017745efb51758

commit r13-1158-ga284fadcce8ef443cc3cc047a8017745efb51758
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jun 17 17:40:49 2022 +0200

    c++: Use fold_non_dependent_expr rather than maybe_constant_value in
__builtin_shufflevector handling [PR106001]

    In this case the STATIC_CAST_EXPR expressions in the call aren't
    type nor value dependent, but maybe_constant_value still ICEs on those
    when processing_template_decl.  Calling fold_non_dependent_expr on it
    instead fixes the ICE and folds them to INTEGER_CSTs.

    2022-06-17  Jakub Jelinek  <jakub@redhat.com>

            PR c++/106001
            * typeck.cc (build_x_shufflevector): Use fold_non_dependent_expr
            instead of maybe_constant_value.

            * g++.dg/ext/builtin-shufflevector-4.C: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935
  2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-06-17 15:41 ` cvs-commit at gcc dot gnu.org
@ 2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
  2022-06-20  9:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-19 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:566e599c8194f789b077eb94a5e45ced2de5b31e

commit r12-8495-g566e599c8194f789b077eb94a5e45ced2de5b31e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jun 17 17:40:49 2022 +0200

    c++: Use fold_non_dependent_expr rather than maybe_constant_value in
__builtin_shufflevector handling [PR106001]

    In this case the STATIC_CAST_EXPR expressions in the call aren't
    type nor value dependent, but maybe_constant_value still ICEs on those
    when processing_template_decl.  Calling fold_non_dependent_expr on it
    instead fixes the ICE and folds them to INTEGER_CSTs.

    2022-06-17  Jakub Jelinek  <jakub@redhat.com>

            PR c++/106001
            * typeck.cc (build_x_shufflevector): Use fold_non_dependent_expr
            instead of maybe_constant_value.

            * g++.dg/ext/builtin-shufflevector-4.C: New test.

    (cherry picked from commit a284fadcce8ef443cc3cc047a8017745efb51758)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935
  2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
@ 2022-06-20  9:50 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-20  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-20  9:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 13:05 [Bug c++/106001] New: [12 Regression] ICE: nexpected expression 'static_cast<char>(1)' of kind static_cast_expr doko at gcc dot gnu.org
2022-06-16 13:41 ` [Bug c++/106001] [12/13 " mpolacek at gcc dot gnu.org
2022-06-16 17:30 ` [Bug c++/106001] [12/13 Regression] ICE: expected expression 'static_cast<char>(1)' of kind static_cast_expr since r12-1128-gef8176e0fac935 jakub at gcc dot gnu.org
2022-06-16 17:51 ` jakub at gcc dot gnu.org
2022-06-17 15:41 ` cvs-commit at gcc dot gnu.org
2022-06-19 10:09 ` cvs-commit at gcc dot gnu.org
2022-06-20  9:50 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).