public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114299] New: ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16
@ 2024-03-10 18:55 zsojka at seznam dot cz
  2024-03-10 19:06 ` [Bug middle-end/114299] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2024-03-10 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114299
           Summary: ICE: SIGSEGV: in dyn_cast<gassign*, gimple>
                    (is-a.h:282) with -mgeneral-regs-only and __bf16
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: error-recovery
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

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

Compiler output:
$ x86_64-pc-linux-gnu-gcc -mgeneral-regs-only testcase.c  -wrapper valgrind,-q
testcase.c: In function 'foo':
testcase.c:10:3: error: invalid conversion from type '__bf16' without option
'-msse2'
   10 |   return __builtin_shufflevector(v, a, 1, 2, 5, 0, 1, 6, 6, 4);
      |   ^~~~~~
testcase.c:8:1: error: SSE register return with SSE disabled
    8 | foo(void)
      | ^~~
==9563== Invalid read of size 1
==9563==    at 0x1AAA648: dyn_cast<gassign*, gimple> (is-a.h:282)
==9563==    by 0x1AAA648: gimple_simplify_VEC_PERM_EXPR(gimple_match_op*,
gimple**, tree_node* (*)(tree_node*), code_helper, tree_node*, tree_node*,
tree_node*, tree_node*) (gimple-match-4.cc:17752)
==9563==    by 0x1C8F915: gimple_resimplify3(gimple**, gimple_match_op*,
tree_node* (*)(tree_node*)) (gimple-match-exports.cc:1107)
==9563==    by 0x1C90EF7: gimple_simplify(gimple*, gimple_match_op*, gimple**,
tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
(gimple-match-exports.cc:898)
==9563==    by 0x117063C: fold_stmt_1(gimple_stmt_iterator*, bool, tree_node*
(*)(tree_node*)) (gimple-fold.cc:6362)
==9563==    by 0x11C14A0: gimplify_modify_expr(tree_node**, gimple**, gimple**,
bool) (gimplify.cc:6582)
==9563==    by 0x11AABE9: gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int) (gimplify.cc:17786)
==9563==    by 0x11AD2D6: gimplify_stmt(tree_node**, gimple**)
(gimplify.cc:7480)
==9563==    by 0x11BB6A0: gimplify_and_add (gimplify.cc:493)
==9563==    by 0x11BB6A0: gimplify_return_expr(tree_node*, gimple**)
(gimplify.cc:1883)
==9563==    by 0x11AB9CA: gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int) (gimplify.cc:18048)
==9563==    by 0x11AD2D6: gimplify_stmt(tree_node**, gimple**)
(gimplify.cc:7480)
==9563==    by 0x11AE3D9: gimplify_bind_expr(tree_node**, gimple**)
(gimplify.cc:1614)
==9563==    by 0x11AB957: gimplify_expr(tree_node**, gimple**, gimple**, bool
(*)(tree_node*), int) (gimplify.cc:17987)
==9563==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==9563== 
testcase.c:10:10: internal compiler error: Segmentation fault
   10 |   return __builtin_shufflevector(v, a, 1, 2, 5, 0, 1, 6, 6, 4);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x151311f crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:319
0x1aaa648 gassign* dyn_cast<gassign*, gimple>(gimple*)
        /repo/gcc-trunk/gcc/is-a.h:282
0x1aaa648 gimple_simplify_VEC_PERM_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*, tree_node*)
        /repo/build-gcc-trunk-amd64/gcc/gimple-match-4.cc:17752
0x1c8f915 gimple_resimplify3
        /repo/gcc-trunk/gcc/gimple-match-exports.cc:1107
0x1c90ef7 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        /repo/gcc-trunk/gcc/gimple-match-exports.cc:898
0x117063c fold_stmt_1
        /repo/gcc-trunk/gcc/gimple-fold.cc:6362
0x11c14a0 gimplify_modify_expr
        /repo/gcc-trunk/gcc/gimplify.cc:6582
0x11aabe9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:17786
0x11ad2d6 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7480
0x11bb6a0 gimplify_and_add(tree_node*, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:493
0x11bb6a0 gimplify_return_expr
        /repo/gcc-trunk/gcc/gimplify.cc:1883
0x11ab9ca gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:18048
0x11ad2d6 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7480
0x11ae3d9 gimplify_bind_expr
        /repo/gcc-trunk/gcc/gimplify.cc:1614
0x11ab957 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /repo/gcc-trunk/gcc/gimplify.cc:17987
0x11c2574 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.cc:7480
0x11c2574 gimplify_body(tree_node*, bool)
        /repo/gcc-trunk/gcc/gimplify.cc:19053
0x11c299a gimplify_function_tree(tree_node*)
        /repo/gcc-trunk/gcc/gimplify.cc:19252
0xfd0ce7 cgraph_node::analyze()
        /repo/gcc-trunk/gcc/cgraphunit.cc:687
0xfd3607 analyze_functions
        /repo/gcc-trunk/gcc/cgraphunit.cc:1251
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] 5+ messages in thread

* [Bug middle-end/114299] ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16
  2024-03-10 18:55 [Bug tree-optimization/114299] New: ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16 zsojka at seznam dot cz
@ 2024-03-10 19:06 ` pinskia at gcc dot gnu.org
  2024-03-11  8:33 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-10 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
          Component|target                      |middle-end

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is an error_mark going through gimple_simplify which should have not
happened ...

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

* [Bug middle-end/114299] ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16
  2024-03-10 18:55 [Bug tree-optimization/114299] New: ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16 zsojka at seznam dot cz
  2024-03-10 19:06 ` [Bug middle-end/114299] " pinskia at gcc dot gnu.org
@ 2024-03-11  8:33 ` rguenth at gcc dot gnu.org
  2024-03-11 10:22 ` cvs-commit at gcc dot gnu.org
  2024-03-11 10:36 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-11  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-03-11
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We gimplify

D.2427 = VIEW_CONVERT_EXPR<W>( VEC_PERM_EXPR < {v, { 0.0, 0.0, 0.0, 0.0 }} ,
{TARGET_EXPR <D.2425, <<< error >>>>, { 0.0, 0.0, 0.0, 0.0 }} , { 1, 2, 9, 0,
1, 10, 10, 8 } > )

and as we gimplify_init_constructor we bail out leaving the half gimplified
expression as

_3 = {TARGET_EXPR <D.2425, >, { 0.0, 0.0, 0.0, 0.0 }}

but up gimplify_stmt will not propagate the error further, in particular
the important caller internal_get_tmp_var has allocated the destination
SSA name but we failed to gimplify it's defintion.

I have a workaround.

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

* [Bug middle-end/114299] ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16
  2024-03-10 18:55 [Bug tree-optimization/114299] New: ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16 zsojka at seznam dot cz
  2024-03-10 19:06 ` [Bug middle-end/114299] " pinskia at gcc dot gnu.org
  2024-03-11  8:33 ` rguenth at gcc dot gnu.org
@ 2024-03-11 10:22 ` cvs-commit at gcc dot gnu.org
  2024-03-11 10:36 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-11 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:119f5ae0455f02568159eafa9008a555605e7d71

commit r14-9425-g119f5ae0455f02568159eafa9008a555605e7d71
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Mar 11 09:35:07 2024 +0100

    middle-end/114299 - missing error recovery from gimplify failure

    When internal_get_tmp_var fails to gimplify the value the temporary
    SSA name is supposed to be initialized with we can leak SSA names
    with a NULL SSA_NAME_DEF_STMT into the IL.  That's bad, so recover
    from this by instead returning a decl in that case.

            PR middle-end/114299
            * gimplify.cc (internal_get_tmp_var): When gimplification
            of VAL failed, return a decl.

            * gcc.target/i386/pr114299.c: New testcase.

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

* [Bug middle-end/114299] ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16
  2024-03-10 18:55 [Bug tree-optimization/114299] New: ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16 zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-03-11 10:22 ` cvs-commit at gcc dot gnu.org
@ 2024-03-11 10:36 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-11 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2024-03-11 10:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 18:55 [Bug tree-optimization/114299] New: ICE: SIGSEGV: in dyn_cast<gassign*, gimple> (is-a.h:282) with -mgeneral-regs-only and __bf16 zsojka at seznam dot cz
2024-03-10 19:06 ` [Bug middle-end/114299] " pinskia at gcc dot gnu.org
2024-03-11  8:33 ` rguenth at gcc dot gnu.org
2024-03-11 10:22 ` cvs-commit at gcc dot gnu.org
2024-03-11 10:36 ` 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).