public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector()
@ 2022-10-18 11:26 zsojka at seznam dot cz
  2022-10-18 11:40 ` [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717 marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2022-10-18 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107303
           Summary: [13 Regression] ICE: in gimplify_var_or_parm_decl, at
                    gimplify.cc:3060 with nested __builtin_shufflevector()
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu

Created attachment 53720
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53720&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.C 
testcase.C: In function 'void foo()':
testcase.C:10:6: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3060
   10 |   u0 *= +__builtin_shufflevector (__builtin_shufflevector (u1, v, 3,
1), u2, 0);
0x7f7d51 gimplify_var_or_parm_decl
        /repo/gcc-trunk/gcc/gimplify.cc:3060
0x13b9655 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:16789
0x13b9527 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:17110
0x13ca377 gimplify_modify_expr
        /repo/gcc-trunk/gcc/gimplify.cc:6121
0x13b9642 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:16328
0x13dc96b gimplify_cleanup_point_expr
        /repo/gcc-trunk/gcc/gimplify.cc:7187
0x13b9a93 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:16721
0x13dbfaf gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7187
0x13dbfaf gimplify_body(tree_node*, bool)
        /repo/gcc-trunk/gcc/gimplify.cc:17588
0x13dc3db gimplify_function_tree(tree_node*)
        /repo/gcc-trunk/gcc/gimplify.cc:17787
0x11ef407 cgraph_node::analyze()
        /repo/gcc-trunk/gcc/cgraphunit.cc:676
0x11f1f37 analyze_functions
        /repo/gcc-trunk/gcc/cgraphunit.cc:1240
0x11f2bcd symbol_table::finalize_compilation_unit()
        /repo/gcc-trunk/gcc/cgraphunit.cc:2500
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.


$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-3351-20221018124615-g35106383c09-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-3351-20221018124615-g35106383c09-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221018 (experimental) (GCC)

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
@ 2022-10-18 11:40 ` marxin at gcc dot gnu.org
  2022-10-18 12:44 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-18 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-10-18
            Summary|[13 Regression] ICE: in     |[13 Regression] ICE: in
                   |gimplify_var_or_parm_decl,  |gimplify_var_or_parm_decl,
                   |at gimplify.cc:3060 with    |at gimplify.cc:3060 with
                   |nested                      |nested
                   |__builtin_shufflevector()   |__builtin_shufflevector()
                   |                            |since
                   |                            |r13-2978-g43faf3e5445b5717
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Target Milestone|---                         |13.0

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-2978-g43faf3e5445b5717.

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
  2022-10-18 11:40 ` [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717 marxin at gcc dot gnu.org
@ 2022-10-18 12:44 ` jakub at gcc dot gnu.org
  2022-10-18 12:46 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-18 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, cp_build_modify_expr calls stabilize_expr on UNARY_PLUS_EXPR of a
TARGET_EXPR.
stabilize_expr wraps it into (another) TARGET_EXPR, puts the TARGET_EXPR as an
initialization statement and returns the TARGET_EXPR_SLOT.
With the TARGET_EXPR_SLOT being used in places other than the
TARGET_EXPR_{SLOT,INITIAL} the r13-2978 change doesn't look correct, because
it replaces the outer TARGET_EXPR with the inner one, but the slot of the outer
might be used elsewhere.
Now, maybe with the nested TARGET_EXPR case we never use the inner
TARGET_EXPR's slot outside of the outer TARGET_EXPR, if that is the case,
perhaps we could still do the optimization, but keep the outer TARGET_EXPR
rather than inner, strip the inner TARGET_EXPR from outer TARGET_EXPR's
initializer and replace all occurrences of the inner slot with the outer slot?

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
  2022-10-18 11:40 ` [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717 marxin at gcc dot gnu.org
  2022-10-18 12:44 ` jakub at gcc dot gnu.org
@ 2022-10-18 12:46 ` jakub at gcc dot gnu.org
  2022-10-18 12:46 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-18 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
One can see it in the original dump:
(void) (u0 = TARGET_EXPR <D.2387, BIT_FIELD_REF < VEC_PERM_EXPR < TARGET_EXPR
<D.2386, BIT_FIELD_REF < VEC_PERM_EXPR < {u1, { 0 }, { 0 }, { 0 }} , v , { 6,
4, 2, 3 } > , 32, 0>> ,
{u2, { 0 }} , { 0, 1 } > , 16, 0>>;, u0 * D.2388;)
where it used to be:
(void) (u0 = TARGET_EXPR <D.2388, TARGET_EXPR <D.2387, BIT_FIELD_REF <
VEC_PERM_EXPR < TARGET_EXPR <D.2386, BIT_FIELD_REF < VEC_PERM_EXPR < {u1, { 0
}, { 0 }, { 0 }} , v , { 6, 4, 2, 3 } > , 32, 0>> ,
{u2, { 0 }} , { 0, 1 } > , 16, 0>>>;, u0 * D.2388;)
before but the removal of D.2388 TARGET_EXPR left D.2388 use in the IL without
it being initialized anywhere.

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-10-18 12:46 ` jakub at gcc dot gnu.org
@ 2022-10-18 12:46 ` jakub at gcc dot gnu.org
  2023-01-23 21:16 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-18 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2022-10-18 12:46 ` jakub at gcc dot gnu.org
@ 2023-01-23 21:16 ` jason at gcc dot gnu.org
  2023-01-24  3:26 ` cvs-commit at gcc dot gnu.org
  2023-01-24  3:26 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2023-01-23 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2023-01-23 21:16 ` jason at gcc dot gnu.org
@ 2023-01-24  3:26 ` cvs-commit at gcc dot gnu.org
  2023-01-24  3:26 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-24  3:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:049a52909075117f5112971cc83952af2a818bc1

commit r13-5318-g049a52909075117f5112971cc83952af2a818bc1
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jan 23 16:25:07 2023 -0500

    c++: TARGET_EXPR collapsing [PR107303]

    In r13-2978 I tried to eliminate TARGET_EXPR around TARGET_EXPR by
    discarding the outer one, but as in this testcase that breaks if the
    TARGET_EXPR_SLOT of the outer one is used elsewhere.  But it should always
    be safe to strip the inner one; if its slot were reused, there would be a
    COMPOUND_EXPR around the TARGET_EXPR.

    For 107329, if we're setting *walk_subtrees, we also need to fold
    TARGET_EXPR_CLEANUP.

            PR c++/107303
            PR c++/107329

    gcc/cp/ChangeLog:

            * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double
            TARGET_EXPR, keep the outer one instead of the inner one.
            (maybe_replace_decl): New.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/builtin-shufflevector-5.C: New test.
            * g++.dg/init/new51.C: New test.

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

* [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717
  2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2023-01-24  3:26 ` cvs-commit at gcc dot gnu.org
@ 2023-01-24  3:26 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2023-01-24  3:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-01-24  3:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 11:26 [Bug c++/107303] New: [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() zsojka at seznam dot cz
2022-10-18 11:40 ` [Bug c++/107303] [13 Regression] ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3060 with nested __builtin_shufflevector() since r13-2978-g43faf3e5445b5717 marxin at gcc dot gnu.org
2022-10-18 12:44 ` jakub at gcc dot gnu.org
2022-10-18 12:46 ` jakub at gcc dot gnu.org
2022-10-18 12:46 ` jakub at gcc dot gnu.org
2023-01-23 21:16 ` jason at gcc dot gnu.org
2023-01-24  3:26 ` cvs-commit at gcc dot gnu.org
2023-01-24  3:26 ` jason 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).