public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/111711] New: [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero
@ 2023-10-06  5:08 zsojka at seznam dot cz
  2023-10-06  7:51 ` [Bug rtl-optimization/111711] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2023-10-06  5:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111711
           Summary: [14 Regression] ICE: in maybe_legitimize_operand, at
                    optabs.cc:8046 at -O1 with division by zero
           Product: gcc
           Version: 14.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: aarch64-unknown-linux-gnu

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

Compiler output:
$ aarch64-unknown-linux-gnu-gcc -O testcase.c
testcase.c: In function 'bar':
testcase.c:4:15: warning: division by zero [-Wdiv-by-zero]
    4 |   x *= x == 0 / 0;
      |               ^
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:11:10: internal compiler error: in maybe_legitimize_operand, at
optabs.cc:8046
   11 |   return bar (822920);
      |          ^~~~~~~~~~~~
0x7ff794 maybe_legitimize_operand
        /repo/gcc-trunk/gcc/optabs.cc:8046
0x7ff794 maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
        /repo/gcc-trunk/gcc/optabs.cc:8194
0x1104c69 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.cc:8213
0x1106789 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        /repo/gcc-trunk/gcc/optabs.cc:8268
0x1106789 emit_conditional_move_1
        /repo/gcc-trunk/gcc/optabs.cc:5242
0x1106b5c emit_conditional_move(rtx_def*, rtx_comparison, rtx_def*, rtx_def*,
machine_mode, int)
        /repo/gcc-trunk/gcc/optabs.cc:5155
0xe646e3 expand_cond_expr_using_cmove
        /repo/gcc-trunk/gcc/expr.cc:9099
0xe50ebd expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        /repo/gcc-trunk/gcc/expr.cc:10520
0xe5713f expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /repo/gcc-trunk/gcc/expr.cc:10821
0xd190c4 expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
        /repo/gcc-trunk/gcc/expr.h:310
0xd190c4 expand_return
        /repo/gcc-trunk/gcc/cfgexpand.cc:3809
0xd190c4 expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.cc:3918
0xd190c4 expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.cc:4044
0xd1f4fe expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.cc:6100
0xd20fb6 execute
        /repo/gcc-trunk/gcc/cfgexpand.cc:6835
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.

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

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

* [Bug rtl-optimization/111711] [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero
  2023-10-06  5:08 [Bug rtl-optimization/111711] New: [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero zsojka at seznam dot cz
@ 2023-10-06  7:51 ` rguenth at gcc dot gnu.org
  2023-10-06  8:29 ` [Bug middle-end/111711] " pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-06  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Keywords|                            |needs-bisection

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

* [Bug middle-end/111711] [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero
  2023-10-06  5:08 [Bug rtl-optimization/111711] New: [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero zsojka at seznam dot cz
  2023-10-06  7:51 ` [Bug rtl-optimization/111711] " rguenth at gcc dot gnu.org
@ 2023-10-06  8:29 ` pinskia at gcc dot gnu.org
  2023-10-06  8:35 ` pinskia at gcc dot gnu.org
  2023-10-06  8:48 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-06  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|needs-bisection             |
   Last reconfirmed|                            |2023-10-06
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It was introduced by r14-2667-gceae1400cf24f329393e96dd9720 .

We have:
  long int x;
  int _3;
  _Bool _5;
  _3 = 0 / 0;
  _5 = _3 == 822920;
  x_7 = _5 ? 822920 : 0;

If I disable the added checks on dealing with rtx_equal_p, the ICE goes away.
The problem is the mode for the result does not match the mode for the
comparison (DImode for the result of the conditional and SImode for the
comparison).

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

* [Bug middle-end/111711] [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero
  2023-10-06  5:08 [Bug rtl-optimization/111711] New: [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero zsojka at seznam dot cz
  2023-10-06  7:51 ` [Bug rtl-optimization/111711] " rguenth at gcc dot gnu.org
  2023-10-06  8:29 ` [Bug middle-end/111711] " pinskia at gcc dot gnu.org
@ 2023-10-06  8:35 ` pinskia at gcc dot gnu.org
  2023-10-06  8:48 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-06  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> It was introduced by r14-2667-gceae1400cf24f329393e96dd9720 .
> 
> We have:
>   long int x;
>   int _3;
>   _Bool _5;
>   _3 = 0 / 0;
>   _5 = _3 == 822920;
>   x_7 = _5 ? 822920 : 0;
> 
> If I disable the added checks on dealing with rtx_equal_p, the ICE goes away.

I mean if I disable the added code trying to reuse the constants, the ICE goes
away.

> The problem is the mode for the result does not match the mode for the
> comparison (DImode for the result of the conditional and SImode for the
> comparison).

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

* [Bug middle-end/111711] [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero
  2023-10-06  5:08 [Bug rtl-optimization/111711] New: [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2023-10-06  8:35 ` pinskia at gcc dot gnu.org
@ 2023-10-06  8:48 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-06  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So I looked further into this and it was actually a dup when I said it was not.

Anyways just marking it as a dup of bug 111260 in the end.

*** This bug has been marked as a duplicate of bug 111260 ***

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

end of thread, other threads:[~2023-10-06  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06  5:08 [Bug rtl-optimization/111711] New: [14 Regression] ICE: in maybe_legitimize_operand, at optabs.cc:8046 at -O1 with division by zero zsojka at seznam dot cz
2023-10-06  7:51 ` [Bug rtl-optimization/111711] " rguenth at gcc dot gnu.org
2023-10-06  8:29 ` [Bug middle-end/111711] " pinskia at gcc dot gnu.org
2023-10-06  8:35 ` pinskia at gcc dot gnu.org
2023-10-06  8:48 ` 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).