public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/107628] New: ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans
@ 2022-11-11  6:32 zsojka at seznam dot cz
  2022-11-18 12:19 ` [Bug target/107628] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2022-11-11  6:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107628
           Summary: ICE: SIGSEGV in commutative_operand_precedence
                    (rtlanal.cc:3770) with -fsignaling-nans
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-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 53879
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53879&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -fsignaling-nans testcase.c
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:4:1: internal compiler error: Segmentation fault
    4 | foo (V v)
      | ^~~
0x13e3a7f crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:314
0x1373710 commutative_operand_precedence(rtx_def*)
        /repo/gcc-trunk/gcc/rtlanal.cc:3770
0x1373897 swap_commutative_operands_p(rtx_def*, rtx_def*)
        /repo/gcc-trunk/gcc/rtlanal.cc:3845
0xfdf808 emit_store_flag_1
        /repo/gcc-trunk/gcc/expmed.cc:5619
0xfdfec6 emit_store_flag(rtx_def*, rtx_code, rtx_def*, rtx_def*, machine_mode,
int, int)
        /repo/gcc-trunk/gcc/expmed.cc:6037
0xfe15ea emit_store_flag_force(rtx_def*, rtx_code, rtx_def*, rtx_def*,
machine_mode, int, int)
        /repo/gcc-trunk/gcc/expmed.cc:6177
0x1d3ff93 gen_cstorebf4(rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        /repo/gcc-trunk/gcc/config/i386/i386.md:1748
0x1298f08 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.cc:8002
0xfdf05a emit_cstore(rtx_def*, insn_code, rtx_code, machine_mode, machine_mode,
int, rtx_def*, rtx_def*, int, machine_mode)
        /repo/gcc-trunk/gcc/expmed.cc:5527
0xfdf932 emit_store_flag_1
        /repo/gcc-trunk/gcc/expmed.cc:5722
0xfdfec6 emit_store_flag(rtx_def*, rtx_code, rtx_def*, rtx_def*, machine_mode,
int, int)
        /repo/gcc-trunk/gcc/expmed.cc:6037
0xfe15ea emit_store_flag_force(rtx_def*, rtx_code, rtx_def*, rtx_def*,
machine_mode, int, int)
        /repo/gcc-trunk/gcc/expmed.cc:6177
0xfef841 do_store_flag
        /repo/gcc-trunk/gcc/expr.cc:13112
0xff0545 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        /repo/gcc-trunk/gcc/expr.cc:10252
0xec31e8 expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.cc:3983
0xec31e8 expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.cc:4044
0xec92ce expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.cc:6096
0xecaecf execute
        /repo/gcc-trunk/gcc/cfgexpand.cc:6822
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-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-3891-20221111040058-gfbad7a74aaa-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-3891-20221111040058-gfbad7a74aaa-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221111 (experimental) (GCC)

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

* [Bug target/107628] ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans
  2022-11-11  6:32 [Bug rtl-optimization/107628] New: ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans zsojka at seznam dot cz
@ 2022-11-18 12:19 ` jakub at gcc dot gnu.org
  2022-11-19  9:17 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-11-18 12:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-11-18

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

Untested fix.

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

* [Bug target/107628] ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans
  2022-11-11  6:32 [Bug rtl-optimization/107628] New: ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans zsojka at seznam dot cz
  2022-11-18 12:19 ` [Bug target/107628] " jakub at gcc dot gnu.org
@ 2022-11-19  9:17 ` cvs-commit at gcc dot gnu.org
  2022-11-19  9:20 ` jakub at gcc dot gnu.org
  2022-11-28 22:31 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-19  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:b1115dbfea4d6df51d608cece7416d658d2e2822

commit r13-4162-gb1115dbfea4d6df51d608cece7416d658d2e2822
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Nov 19 10:17:01 2022 +0100

    i386: Outline fast BF -> SF conversion and fix up sNaN handling in it
[PR107628]

    On Fri, Oct 21, 2022 at 10:23:14AM +0200, Uros Bizjak wrote:
    > OK, but now we have two more copies of a function that effectively
    > extends BF to SF. Can you please split this utility function out and
    > use it here and in cbranchbf4/cstorebf4? I'm talking about this part:
    >
    > +      op = gen_lowpart (HImode, op1);
    > +      if (CONST_INT_P (op))
    > +       op = simplify_const_unary_operation (FLOAT_EXTEND, SFmode,
    > +                                            op1, BFmode);
    > +      else
    > +       {
    > +         rtx t1 = gen_reg_rtx (SImode);
    > +         emit_insn (gen_zero_extendhisi2 (t1, op));
    > +         emit_insn (gen_ashlsi3 (t1, t1, GEN_INT (16)));
    > +         op = gen_lowpart (SFmode, t1);
    > +       }
    >
    > Taking this a bit further, it looks like a generic function to extend
    > BF to SF, when extendbfsf2 named function is not defined.
    >
    > The above could be a follow-up patch, the proposed patch is OK.

    Sorry for the delay, only got to this now.
    And I'm fixing the sNaN handling in it too.  If the argument is a BFmode
sNaN
    constant, we want in this case just a SFmode sNaN constant, but
    simplify_const_unary_operation (FLOAT_EXTEND, ...)
    in that case returns NULL (as normally conversions of a sNaN to some
    other float type should raise an exception).  In this case we want
    to bypass that, as we know the sNaN will be used immediately in the SFmode
    comparison a few instructions later.  The patch fixes it by just
    simplifying the lowpart to HImode and its zero extension to SImode, then
    force into a pseudo and do the left shift and subreg to SFmode on the
    pseudo.  CSE or combine can handle it later.

    2022-11-19  Jakub Jelinek  <jakub@redhat.com>

            PR target/107628
            * config/i386/i386-protos.h (ix86_expand_fast_convert_bf_to_sf):
            Declare.
            * config/i386/i386-expand.cc (ix86_expand_fast_convert_bf_to_sf):
New
            function.
            * config/i386/i386.md (cbranchbf4, cstorebf4): Use it.

            * gcc.target/i386/pr107628.c: New test.

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

* [Bug target/107628] ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans
  2022-11-11  6:32 [Bug rtl-optimization/107628] New: ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans zsojka at seznam dot cz
  2022-11-18 12:19 ` [Bug target/107628] " jakub at gcc dot gnu.org
  2022-11-19  9:17 ` cvs-commit at gcc dot gnu.org
@ 2022-11-19  9:20 ` jakub at gcc dot gnu.org
  2022-11-28 22:31 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-11-19  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug target/107628] ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans
  2022-11-11  6:32 [Bug rtl-optimization/107628] New: ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2022-11-19  9:20 ` jakub at gcc dot gnu.org
@ 2022-11-28 22:31 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

end of thread, other threads:[~2022-11-28 22:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11  6:32 [Bug rtl-optimization/107628] New: ICE: SIGSEGV in commutative_operand_precedence (rtlanal.cc:3770) with -fsignaling-nans zsojka at seznam dot cz
2022-11-18 12:19 ` [Bug target/107628] " jakub at gcc dot gnu.org
2022-11-19  9:17 ` cvs-commit at gcc dot gnu.org
2022-11-19  9:20 ` jakub at gcc dot gnu.org
2022-11-28 22:31 ` pinskia 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).