public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483
@ 2022-01-25 16:02 asolokha at gmx dot com
  2022-01-25 16:59 ` [Bug middle-end/104226] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: asolokha at gmx dot com @ 2022-01-25 16:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104226
           Summary: ICE in fold_vec_perm, at fold-const.cc:10483
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: x86_64-unknown-linux-gnu

g++ 12.0.0 20220123 snapshot (g:2da90ad39bf8fa9ee287e040d1f4411cb7a2e7ed) ICEs
when compiling gcc/testsuite/gcc.target/i386/pr101046.c:

% x86_64-unknown-linux-gnu-g++-12.0.1 -c
gcc/testsuite/gcc.target/i386/pr101046.c
gcc/testsuite/gcc.target/i386/pr101046.c: In function 'U foo()':
gcc/testsuite/gcc.target/i386/pr101046.c:14:74: internal compiler error: in
fold_vec_perm, at fold-const.cc:10483
   14 |                                                            5, 5, 0, 2),
U);
      |                                                                        
 ^
0x798fe8 fold_vec_perm(tree_node*, tree_node*, tree_node*, vec_perm_indices
const&)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/fold-const.cc:10483
0x18cd579 generic_simplify_VEC_PERM_EXPR
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/build/gcc/generic-match.cc:90825
0xe33f7b fold_ternary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*, tree_node*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/fold-const.cc:12777
0x995083 cxx_eval_trinary_expression
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:5472
0x985798 cxx_eval_constant_expression
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:7119
0x98df9e cxx_eval_internal_function
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:1839
0x98238e cxx_eval_call_expression
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:2395
0x985647 cxx_eval_constant_expression
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:6627
0x988743 cxx_eval_outermost_constant_expr
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:7700
0x98d54e maybe_constant_value(tree_node*, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/constexpr.cc:7994
0xa2548b fold_for_warn(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/expr.cc:416
0xbc6e08 maybe_warn_about_returning_address_of_local
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/typeck.cc:10067
0xbc6e08 check_return_expr(tree_node*, bool*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/typeck.cc:10730
0xb6fbde finish_return_stmt(tree_node*)
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/semantics.cc:1195
0xace69c cp_parser_jump_statement
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/parser.cc:14313
0xace69c cp_parser_statement
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/parser.cc:12318
0xacf34d cp_parser_statement_seq_opt
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/parser.cc:12856
0xacf427 cp_parser_compound_statement
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/parser.cc:12808
0xaeffd5 cp_parser_function_body
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/parser.cc:25052
0xaeffd5 cp_parser_ctor_initializer_opt_and_function_body
       
/var/tmp/portage/sys-devel/gcc-12.0.1_p20220123/work/gcc-12-20220123/gcc/cp/parser.cc:25103

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

* [Bug middle-end/104226] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f
  2022-01-25 16:02 [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483 asolokha at gmx dot com
@ 2022-01-25 16:59 ` marxin at gcc dot gnu.org
  2022-01-25 18:50 ` [Bug middle-end/104226] [12 Regression] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-25 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-01-25
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
            Summary|ICE in fold_vec_perm, at    |ICE in fold_vec_perm, at
                   |fold-const.cc:10483         |fold-const.cc:10483 since
                   |                            |r12-6821-g053bcc97f4a59e3f
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |12.0

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-6821-g053bcc97f4a59e3f.

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

* [Bug middle-end/104226] [12 Regression] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f
  2022-01-25 16:02 [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483 asolokha at gmx dot com
  2022-01-25 16:59 ` [Bug middle-end/104226] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f marxin at gcc dot gnu.org
@ 2022-01-25 18:50 ` jakub at gcc dot gnu.org
  2022-01-25 20:54 ` [Bug c++/104226] " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-25 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/104226] [12 Regression] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f
  2022-01-25 16:02 [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483 asolokha at gmx dot com
  2022-01-25 16:59 ` [Bug middle-end/104226] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f marxin at gcc dot gnu.org
  2022-01-25 18:50 ` [Bug middle-end/104226] [12 Regression] " jakub at gcc dot gnu.org
@ 2022-01-25 20:54 ` jakub at gcc dot gnu.org
  2022-01-26 18:41 ` cvs-commit at gcc dot gnu.org
  2022-01-26 18:44 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-25 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 52288
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52288&action=edit
gcc12-pr104226.patch

Untested fix.

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

* [Bug c++/104226] [12 Regression] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f
  2022-01-25 16:02 [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483 asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-01-25 20:54 ` [Bug c++/104226] " jakub at gcc dot gnu.org
@ 2022-01-26 18:41 ` cvs-commit at gcc dot gnu.org
  2022-01-26 18:44 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-26 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:abea1c9a252ef7712ab800360e1e0e2697ee14f2

commit r12-6881-gabea1c9a252ef7712ab800360e1e0e2697ee14f2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jan 26 19:40:29 2022 +0100

    c++: Fix up handling of vector CONSTRUCTORs with vectors in it in
constexpr.cc [PR104226]

    The middle-end uses sometimes VECTOR_TYPE CONSTRUCTORs that contain
    some other VECTOR_TYPE elements in it (should be with compatible element
    size and smaller number of elements, e.g. a V8SImode vector can be
    constructed as { V4SImode_var_1, V4SImode_var_2 }), and expansion of
    __builtin_shufflevector emits these early, so constexpr.cc can see those
    too.
    constexpr.cc already has special cases for NULL index which is typical
    for VECTOR_TYPE CONSTRUCTORs, and for VECTOR_TYPE CONSTRUCTORs that
    contain just scalar elts that works just fine - init_subob_ctx just
    returns on non-aggregate elts and get_or_insert_ctor_field has
      if (TREE_CODE (type) == VECTOR_TYPE && index == NULL_TREE)
        {
          CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (ctor), index, NULL_TREE);
          return &CONSTRUCTOR_ELTS (ctor)->last();
        }
    handling for it.  But for the vector in vector case init_subob_ctx would
    try to create a sub-CONSTRUCTOR and even didn't handle the NULL index
    case well, so instead of creating the sub-CONSTRUCTOR after the elts
already
    in it overwrote the first one.  So
    (V8SImode) { { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }
    became
    (V8SImode) { 0, 0, 0, 0 }
    The following patch fixes it by not forcing a sub-CONSTRUCTOR for this
    vector in vector case.

    2022-01-26  Jakub Jelinek  <jakub@redhat.com>

            PR c++/104226
            * constexpr.cc (init_subob_ctx): For vector ctors containing
            vector elements, ensure appending to the same ctor instead of
            creating another one.

            * g++.dg/cpp0x/constexpr-104226.C: New test.

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

* [Bug c++/104226] [12 Regression] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f
  2022-01-25 16:02 [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483 asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-01-26 18:41 ` cvs-commit at gcc dot gnu.org
@ 2022-01-26 18:44 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-26 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-01-26 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 16:02 [Bug middle-end/104226] New: ICE in fold_vec_perm, at fold-const.cc:10483 asolokha at gmx dot com
2022-01-25 16:59 ` [Bug middle-end/104226] ICE in fold_vec_perm, at fold-const.cc:10483 since r12-6821-g053bcc97f4a59e3f marxin at gcc dot gnu.org
2022-01-25 18:50 ` [Bug middle-end/104226] [12 Regression] " jakub at gcc dot gnu.org
2022-01-25 20:54 ` [Bug c++/104226] " jakub at gcc dot gnu.org
2022-01-26 18:41 ` cvs-commit at gcc dot gnu.org
2022-01-26 18:44 ` jakub 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).