public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
@ 2023-04-21  8:10 marxin at gcc dot gnu.org
  2023-04-21  8:11 ` [Bug tree-optimization/109583] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-04-21  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109583
           Summary: [14 Regression] ICE in related_vector_mode, at
                    stor-layout.cc:537 since r14-22-g2349e69125335d
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The following crashes:

$ cat ice.c
typedef float v8sf __attribute__((vector_size(32)));
typedef int v8si __attribute__((vector_size(32)));
v8sf foo1 (v8sf x, v8sf y)
{
  v8sf tem0 = x - y;
  v8sf tem1 = x + y;
  return __builtin_shuffle (tem0, tem1, (v8si) { 0, 9, 2, 11, 4, 13, 6, 15 });
}

$ gcc ice.c -O -c
ice.c: In function ‘foo1’:
ice.c:4:1: warning: AVX vector return without AVX enabled changes the ABI
[-Wpsabi]
    4 | {
      | ^
ice.c:3:6: note: the ABI for passing parameters with 32-byte alignment has
changed in GCC 4.6
    3 | v8sf foo1 (v8sf x, v8sf y)
      |      ^~~~
during GIMPLE pass: ccp
ice.c:8:1: internal compiler error: Floating point exception
    8 | }
      | ^
0xbbbc0f crash_signal
        /home/marxin/Programming/gcc/gcc/toplev.cc:314
0xbb7a2b mode_to_bytes(machine_mode)
        /home/marxin/Programming/gcc/gcc/machmode.h:551
0xbb7a2b if_nonpoly<scalar_mode::measurement_type,
scalar_mode::measurement_type,
poly_int_traits<scalar_mode::measurement_type>::is_poly>::type
GET_MODE_SIZE<scalar_mode>(scalar_mode const&)
        /home/marxin/Programming/gcc/gcc/machmode.h:648
0xbb7a2b default_vectorize_related_mode(machine_mode, scalar_mode, poly_int<1u,
unsigned long>)
        /home/marxin/Programming/gcc/gcc/targhooks.cc:1560
0xfe3635 gimple_simplify_211
        /dev/shm/objdir/gcc/gimple-match.cc:18417
0x10edb5c gimple_simplify_VEC_PERM_EXPR
        /dev/shm/objdir/gcc/gimple-match.cc:208860
0xf641b9 gimple_resimplify3
        /home/marxin/Programming/gcc/gcc/gimple-match-head.cc:399
0xfa1197 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        /home/marxin/Programming/gcc/gcc/gimple-match-head.cc:1115
0x8f8c4e gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
        /home/marxin/Programming/gcc/gcc/gimple-fold.cc:7444
0xca8913 ccp_fold
        /home/marxin/Programming/gcc/gcc/tree-ssa-ccp.cc:1289
0xca8913 evaluate_stmt
        /home/marxin/Programming/gcc/gcc/tree-ssa-ccp.cc:2220
0xcaa1cd visit_assignment
        /home/marxin/Programming/gcc/gcc/tree-ssa-ccp.cc:2853
0xd399c3 ssa_propagation_engine::simulate_stmt(gimple*)
        /home/marxin/Programming/gcc/gcc/tree-ssa-propagate.cc:220
0xd39c3a ssa_propagation_engine::simulate_block(basic_block_def*)
        /home/marxin/Programming/gcc/gcc/tree-ssa-propagate.cc:327
0xd3a0b8 ssa_propagation_engine::ssa_propagate()
        /home/marxin/Programming/gcc/gcc/tree-ssa-propagate.cc:477
0xc9be51 do_ssa_ccp
        /home/marxin/Programming/gcc/gcc/tree-ssa-ccp.cc:2972
0xc9be51 execute
        /home/marxin/Programming/gcc/gcc/tree-ssa-ccp.cc:3018
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/109583] [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
@ 2023-04-21  8:11 ` marxin at gcc dot gnu.org
  2023-04-21 10:14 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-04-21  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-04-21
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/109583] [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
  2023-04-21  8:11 ` [Bug tree-optimization/109583] " marxin at gcc dot gnu.org
@ 2023-04-21 10:14 ` rguenth at gcc dot gnu.org
  2023-04-21 11:22 ` [Bug tree-optimization/109583] [13/14 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-21 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug tree-optimization/109583] [13/14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
  2023-04-21  8:11 ` [Bug tree-optimization/109583] " marxin at gcc dot gnu.org
  2023-04-21 10:14 ` rguenth at gcc dot gnu.org
@ 2023-04-21 11:22 ` jakub at gcc dot gnu.org
  2023-04-21 11:22 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-21 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

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
            Summary|[14 Regression] ICE in      |[13/14 Regression] ICE in
                   |related_vector_mode, at     |related_vector_mode, at
                   |stor-layout.cc:537 since    |stor-layout.cc:537 since
                   |r14-22-g2349e69125335d      |r14-22-g2349e69125335d
             Status|NEW                         |ASSIGNED

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Change it to:
typedef float v8sf __attribute__((vector_size (8 * sizeof (float))));
typedef int v8si __attribute__((vector_size (8 * sizeof (int))));

v8sf
foo (v8sf x, v8sf y)
{
  v8sf tem0 = x + y;
  v8sf tem1 = x - y;
  return __builtin_shuffle (tem0, tem1, (v8si) { 0, 9, 2, 11, 4, 13, 6, 15 });
}
and it started to ICE already in r13-4122-g1bc7efa948f751 (again -O1 -mno-avx
-Wno-psabi).

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

* [Bug tree-optimization/109583] [13/14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-04-21 11:22 ` [Bug tree-optimization/109583] [13/14 " jakub at gcc dot gnu.org
@ 2023-04-21 11:22 ` jakub at gcc dot gnu.org
  2023-04-22  8:25 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-21 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|14.0                        |13.0

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

* [Bug tree-optimization/109583] [13/14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-04-21 11:22 ` jakub at gcc dot gnu.org
@ 2023-04-22  8:25 ` cvs-commit at gcc dot gnu.org
  2023-04-22  8:33 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-22  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:c58c0771b7a3dbd2a00cd4b6ca2301d74b6cd4e2

commit r14-163-gc58c0771b7a3dbd2a00cd4b6ca2301d74b6cd4e2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 22 10:24:29 2023 +0200

    match.pd: Fix fneg/fadd optimization [PR109583]

    The following testcase ICEs on x86, foo function since my r14-22
    improvement, but bar already since r13-4122.  The problem is the same,
    in the if expression related_vector_mode is called and that starts with
      gcc_assert (VECTOR_MODE_P (vector_mode));
    but nothing in the fneg/fadd match.pd pattern actually checks if the
    VEC_PERM type has VECTOR_MODE_P (vec_mode).  In this case it has BLKmode
    and so it ICEs.

    The following patch makes sure we don't ICE on it.

    2023-04-22  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/109583
            * match.pd (fneg/fadd simplify): Don't call related_vector_mode
            if vec_mode is not VECTOR_MODE_P.

            * gcc.dg/pr109583.c: New test.

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

* [Bug tree-optimization/109583] [13/14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-04-22  8:25 ` cvs-commit at gcc dot gnu.org
@ 2023-04-22  8:33 ` cvs-commit at gcc dot gnu.org
  2023-04-24  9:12 ` marxin at gcc dot gnu.org
  2023-04-24  9:15 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-22  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:9b6bf076c11cba0f9ccdace63e8b4044b1a858ea

commit r13-7234-g9b6bf076c11cba0f9ccdace63e8b4044b1a858ea
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 22 10:24:29 2023 +0200

    match.pd: Fix fneg/fadd optimization [PR109583]

    The following testcase ICEs on x86, foo function since my r14-22
    improvement, but bar already since r13-4122.  The problem is the same,
    in the if expression related_vector_mode is called and that starts with
      gcc_assert (VECTOR_MODE_P (vector_mode));
    but nothing in the fneg/fadd match.pd pattern actually checks if the
    VEC_PERM type has VECTOR_MODE_P (vec_mode).  In this case it has BLKmode
    and so it ICEs.

    The following patch makes sure we don't ICE on it.

    2023-04-22  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/109583
            * match.pd (fneg/fadd simplify): Don't call related_vector_mode
            if vec_mode is not VECTOR_MODE_P.

            * gcc.dg/pr109583.c: New test.

    (cherry picked from commit c58c0771b7a3dbd2a00cd4b6ca2301d74b6cd4e2)

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

* [Bug tree-optimization/109583] [13/14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-04-22  8:33 ` cvs-commit at gcc dot gnu.org
@ 2023-04-24  9:12 ` marxin at gcc dot gnu.org
  2023-04-24  9:15 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-04-24  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed now?

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

* [Bug tree-optimization/109583] [13/14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d
  2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-04-24  9:12 ` marxin at gcc dot gnu.org
@ 2023-04-24  9:15 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-24  9:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yes.

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

end of thread, other threads:[~2023-04-24  9:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21  8:10 [Bug tree-optimization/109583] New: [14 Regression] ICE in related_vector_mode, at stor-layout.cc:537 since r14-22-g2349e69125335d marxin at gcc dot gnu.org
2023-04-21  8:11 ` [Bug tree-optimization/109583] " marxin at gcc dot gnu.org
2023-04-21 10:14 ` rguenth at gcc dot gnu.org
2023-04-21 11:22 ` [Bug tree-optimization/109583] [13/14 " jakub at gcc dot gnu.org
2023-04-21 11:22 ` jakub at gcc dot gnu.org
2023-04-22  8:25 ` cvs-commit at gcc dot gnu.org
2023-04-22  8:33 ` cvs-commit at gcc dot gnu.org
2023-04-24  9:12 ` marxin at gcc dot gnu.org
2023-04-24  9:15 ` 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).