public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp"
@ 2021-02-27  6:53 suochenyao at 163 dot com
  2021-03-01 10:11 ` [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722 marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: suochenyao at 163 dot com @ 2021-02-27  6:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99296
           Summary: ICE:in irange_set_anti_range, at value-range.cc:205
                    with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: suochenyao at 163 dot com
  Target Milestone: ---

*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
struct {
  signed a : 1;
} b, c;
void d() { b.a |= c.a |= 0 != 2; }
int main() {}
*******************************************************************************
gcc version:
$ gcc --version
gcc (GCC) 11.0.1 20210226 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*******************************************************************************
Command Lines:
$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv -Os -fno-toplevel-reorder
-fno-tree-bit-ccp a.c
during GIMPLE pass: evrp
a.c: In function ‘d’:
a.c:5:1: internal compiler error: in irange_set_anti_range, at
value-range.cc:205
    5 | int main() {}
      | ^~~
0x7714e6 irange::irange_set_anti_range(tree_node*, tree_node*)
        ../../gcc/value-range.cc:205
0x18ff2ea irange::set_nonzero(tree_node*)
        ../../gcc/value-range.h:557
0x18ff2ea wi_optimize_and_or
        ../../gcc/range-op.cc:2204
0x1900620 operator_bitwise_or::wi_fold(irange&, tree_node*,
generic_wide_int<wide_int_storage> const&, generic_wide_int<wide_int_storage>
const&, generic_wide_int<wide_int_storage> const&,
generic_wide_int<wide_int_storage> const&) const
        ../../gcc/range-op.cc:2510
0x18f6897 range_operator::fold_range(irange&, tree_node*, irange const&, irange
const&) const
        ../../gcc/range-op.cc:153
0x17ff999 gimple_range_fold(irange&, gimple const*, irange const&, irange
const&)
        ../../gcc/gimple-range.cc:220
0x1803501 gimple_ranger::range_of_range_op(irange&, gimple*)
        ../../gcc/gimple-range.cc:444
0x18035c8 gimple_ranger::calc_stmt(irange&, gimple*, tree_node*)
        ../../gcc/gimple-range.cc:374
0x180398a gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
        ../../gcc/gimple-range.cc:1068
0x17ff828 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
        ../../gcc/gimple-range.cc:960
0x10fae61 range_query::value_of_expr(tree_node*, gimple*)
        ../../gcc/value-query.cc:86
0x180de81 hybrid_folder::value_of_expr(tree_node*, gimple*)
        ../../gcc/gimple-ssa-evrp.c:235
0xfa9966 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc/tree-ssa-propagate.c:1112
0x17d6197 dom_walker::walk(basic_block_def*)
        ../../gcc/domwalk.c:309
0xfa8b95 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        ../../gcc/tree-ssa-propagate.c:1283
0x180daf6 execute_early_vrp
        ../../gcc/gimple-ssa-evrp.c:349
Please submit a full bug report,
with preprocessed source if appropriate.
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/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
@ 2021-03-01 10:11 ` marxin at gcc dot gnu.org
  2021-03-16 11:51 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-01 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
      Known to work|                            |10.2.0
            Summary|ICE:in                      |[11 Regression] ICE:in
                   |irange_set_anti_range, at   |irange_set_anti_range, at
                   |value-range.cc:205 with     |value-range.cc:205 with
                   |"-Os -fno-toplevel-reorder  |"-Os -fno-toplevel-reorder
                   |-fno-tree-bit-ccp"          |-fno-tree-bit-ccp" since
                   |                            |r11-5105-ga5f9c27bfc441722
      Known to fail|                            |11.0
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-03-01

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-5105-ga5f9c27bfc441722.
Minimal options: gcc pr99296.c -fno-tree-bit-ccp -Os.

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
  2021-03-01 10:11 ` [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722 marxin at gcc dot gnu.org
@ 2021-03-16 11:51 ` rguenth at gcc dot gnu.org
  2021-03-16 13:42 ` aldyh at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-16 11:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |11.0

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
  2021-03-01 10:11 ` [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722 marxin at gcc dot gnu.org
  2021-03-16 11:51 ` rguenth at gcc dot gnu.org
@ 2021-03-16 13:42 ` aldyh at gcc dot gnu.org
  2021-03-17 10:03 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-03-16 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |aldyh at gcc dot gnu.org

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I'll take a look.

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
                   ` (2 preceding siblings ...)
  2021-03-16 13:42 ` aldyh at gcc dot gnu.org
@ 2021-03-17 10:03 ` jakub at gcc dot gnu.org
  2021-03-17 10:08 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-17 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
signed 1 bit precision are always a nightmare to deal with.
      wide_int lim1 = wi::sub (w_min, 1, sign, &ovf);
      gcc_checking_assert (ovf != wi::OVF_OVERFLOW);
1 is not really representable in that type, which is why I think we're getting
the overflow.  So I think we need to use
      wide_int lim1
        = !sign && w_min.get_precision () == 1
          ? wi::add (w_min, -1, sign, &ovf)
          : wi::sub (w_min, 1, sign, &ovf);
instead.
And in the other spot in the same function the other way around (when it is
called on signed precision 1 -1, -1.  One can't wi::add (w_max, 1, sign, &ovf)
either, needs wi::sub (w_max, -1, sign, &ovf).

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
                   ` (3 preceding siblings ...)
  2021-03-17 10:03 ` jakub at gcc dot gnu.org
@ 2021-03-17 10:08 ` jakub at gcc dot gnu.org
  2021-03-18 15:16 ` aldyh at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-17 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or perhaps better use as the condition whether type_range.upper_bound () is
zero.

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
                   ` (4 preceding siblings ...)
  2021-03-17 10:08 ` jakub at gcc dot gnu.org
@ 2021-03-18 15:16 ` aldyh at gcc dot gnu.org
  2021-03-23  6:58 ` cvs-commit at gcc dot gnu.org
  2021-03-23  6:59 ` aldyh at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-03-18 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Created attachment 50420
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50420&action=edit
proposed patch

As Jakub has mentioned, this is a problem with signed 1-bit precision.

Legacy anti-ranges has special cased this scenario, so I've adapted out some
common logic both alternatives can use.

Testing in progress.

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
                   ` (5 preceding siblings ...)
  2021-03-18 15:16 ` aldyh at gcc dot gnu.org
@ 2021-03-23  6:58 ` cvs-commit at gcc dot gnu.org
  2021-03-23  6:59 ` aldyh at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-23  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:

https://gcc.gnu.org/g:88081d38bd82562b6e2d6a4a275e7f6f2aac3422

commit r11-7773-g88081d38bd82562b6e2d6a4a275e7f6f2aac3422
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Mar 18 16:05:27 2021 +0100

    Handle setting of 1-bit anti-ranges uniformly.

            PR tree-optimization/99296
            * value-range.cc (irange::irange_set_1bit_anti_range): New.
            (irange::irange_set_anti_range): Call irange_set_1bit_anti_range
            * value-range.h (irange::irange_set_1bit_anti_range): New.

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

* [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722
  2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
                   ` (6 preceding siblings ...)
  2021-03-23  6:58 ` cvs-commit at gcc dot gnu.org
@ 2021-03-23  6:59 ` aldyh at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-03-23  6:59 UTC (permalink / raw)
  To: gcc-bugs

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

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

--- Comment #7 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Fixed in trunk.

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

end of thread, other threads:[~2021-03-23  6:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27  6:53 [Bug tree-optimization/99296] New: ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" suochenyao at 163 dot com
2021-03-01 10:11 ` [Bug tree-optimization/99296] [11 Regression] ICE:in irange_set_anti_range, at value-range.cc:205 with "-Os -fno-toplevel-reorder -fno-tree-bit-ccp" since r11-5105-ga5f9c27bfc441722 marxin at gcc dot gnu.org
2021-03-16 11:51 ` rguenth at gcc dot gnu.org
2021-03-16 13:42 ` aldyh at gcc dot gnu.org
2021-03-17 10:03 ` jakub at gcc dot gnu.org
2021-03-17 10:08 ` jakub at gcc dot gnu.org
2021-03-18 15:16 ` aldyh at gcc dot gnu.org
2021-03-23  6:58 ` cvs-commit at gcc dot gnu.org
2021-03-23  6:59 ` aldyh 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).