public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106444] New: vrange_printer::visit ICEs
@ 2022-07-26  7:49 rguenth at gcc dot gnu.org
  2022-07-26  7:49 ` [Bug tree-optimization/106444] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-26  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106444
           Summary: vrange_printer::visit ICEs
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For the testcase in PR105651 I see with -fdump-tree-all:

t.C: In function ‘std::string f()’:
t.C:3:13: internal compiler error: tree check: expected integer_cst, have
addr_expr in to_wide, at tree.h:6205
    3 | bool test(std::array<int8_t, 8>& a, std::array<int8_t, 8>& b)
      |             ^
0x1cd3d8d tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /space/rguenther/src/gcc/gcc/tree.cc:8817
0xbb7be1 tree_check(tree_node const*, char const*, int, char const*, tree_code)
        /space/rguenther/src/gcc/gcc/tree.h:3764
0xc5235a wi::to_wide(tree_node const*)
        /space/rguenther/src/gcc/gcc/tree.h:6205
0x1d0ab22 irange::legacy_upper_bound(unsigned int) const
        /space/rguenther/src/gcc/gcc/value-range.cc:875
0x112a26d irange::upper_bound(unsigned int) const
        /space/rguenther/src/gcc/gcc/value-range.h:935
0x1d1bd9d vrange_printer::visit(irange const&) const
        /space/rguenther/src/gcc/gcc/value-range-pretty-print.cc:69
0x1d08349 irange::accept(vrange_visitor const&) const
        /space/rguenther/src/gcc/gcc/value-range.cc:37
0x1d088d0 vrange::dump(_IO_FILE*) const
        /space/rguenther/src/gcc/gcc/value-range.cc:227
0x1d1b730 value_range_equiv::dump(_IO_FILE*) const
        /space/rguenther/src/gcc/gcc/value-range-equiv.cc:287
0x1d1b8b1 dump_value_range(_IO_FILE*, value_range_equiv const*)
        /space/rguenther/src/gcc/gcc/value-range-equiv.cc:317
0x1d7ec2a vr_values::dump(_IO_FILE*)
        /space/rguenther/src/gcc/gcc/vr-values.cc:1861
0x1cafed6 vrp_prop::finalize()
        /space/rguenther/src/gcc/gcc/tree-vrp.cc:4005
0x1cb0618 execute_vrp
        /space/rguenther/src/gcc/gcc/tree-vrp.cc:4218
0x1cb0aef execute
        /space/rguenther/src/gcc/gcc/tree-vrp.cc:4433
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.

that's because vrange_printer::visit doesn't handle symbolic ranges.

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
@ 2022-07-26  7:49 ` rguenth at gcc dot gnu.org
  2022-07-26  7:56 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-26  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw,

      tree lb = wide_int_to_tree (r.type (), r.lower_bound (i));
      tree ub = wide_int_to_tree (r.type (), r.upper_bound (i));

is totally ugly - we have wide_int pp_, and for ranges with tree storage
we can print the tree directly (also avoiding the ICE).

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
  2022-07-26  7:49 ` [Bug tree-optimization/106444] " rguenth at gcc dot gnu.org
@ 2022-07-26  7:56 ` rguenth at gcc dot gnu.org
  2022-07-26  8:29 ` aldyh at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-26  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
hmm, but r.symbolic_p returns false.  Ah, because it's "wrong" in the way
of treating &MEM <const char[16]> [(void *)&D.42061 + 16B] as not symbolic
(it's an address constant).  It's still not an irange though?

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
  2022-07-26  7:49 ` [Bug tree-optimization/106444] " rguenth at gcc dot gnu.org
  2022-07-26  7:56 ` rguenth at gcc dot gnu.org
@ 2022-07-26  8:29 ` aldyh at gcc dot gnu.org
  2022-07-26  9:42 ` aldyh at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-07-26  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

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
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-07-26
     Ever confirmed|0                           |1

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> hmm, but r.symbolic_p returns false.  Ah, because it's "wrong" in the way
> of treating &MEM <const char[16]> [(void *)&D.42061 + 16B] as not symbolic
> (it's an address constant).  It's still not an irange though?

Ughh, that looks totally broken, and probably seeped in because only legacy VRP
saw these ranges.  I'm hesitant to fix any of this, as it's all slated for
removal shortly.

The pretty printer for irange incorrectly assumes irange's are free from all
this symbolic stuff.  Perhaps we could special case the !r.constant_p() case
and just print the trees.  I'd like to keep the loop going over wide_ints, as
we're eventually going to wide ints later this cycle.

I didn't know about pp_wide_integer.  If it works the same as going through the
tree, I'll gladly change the code.

Thanks for looking into this.

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-07-26  8:29 ` aldyh at gcc dot gnu.org
@ 2022-07-26  9:42 ` aldyh at gcc dot gnu.org
  2022-07-26 11:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-07-26  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-07-26  9:42 ` aldyh at gcc dot gnu.org
@ 2022-07-26 11:07 ` cvs-commit at gcc dot gnu.org
  2022-07-26 11:07 ` aldyh at gcc dot gnu.org
  2022-08-08 18:43 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-26 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:2615502971ca11c15f1949c03d93ccfe1ce54f55

commit r13-1840-g2615502971ca11c15f1949c03d93ccfe1ce54f55
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Tue Jul 26 11:03:17 2022 +0200

    Handle non constant ranges in irange pretty printer.

    Technically iranges only exist in constant form, but we allow symbolic
    ones before arriving in the ranger, so legacy VRP can work.  This fixes the
    ICE when attempting to print symbolic iranges in the pretty printer.

    For consistency's sake, I have made sure irange::get_nonzero_bits does
    not similarly ICE on a symbolic range, even though no one should be
    querying nonzero bits on such a range.  This should all melt away
    when legacy disappears, because all these methods are slated for
    removal (min, max, kind, symbolic_p, constant_p, etc).

    Finally, Richi suggested using pp_wide_int in the pretty printer
    instead of going through trees.  I've adapted a test, since
    dump_generic_node seems to work slightly different.

            PR tree-optimization/106444

    gcc/ChangeLog:

            * value-range-pretty-print.cc (vrange_printer::visit): Handle
            legacy ranges.
            (vrange_printer::print_irange_bound): Work on wide_int's.
            * value-range-pretty-print.h (print_irange_bound): Same.
            * value-range.cc (irange::get_nonzero_bits): Handle legacy ranges.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/evrp4.c: Adjust.

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-07-26 11:07 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 11:07 ` aldyh at gcc dot gnu.org
  2022-08-08 18:43 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-07-26 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
fixed

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

* [Bug tree-optimization/106444] vrange_printer::visit ICEs
  2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-07-26 11:07 ` aldyh at gcc dot gnu.org
@ 2022-08-08 18:43 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-08 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

end of thread, other threads:[~2022-08-08 18:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26  7:49 [Bug tree-optimization/106444] New: vrange_printer::visit ICEs rguenth at gcc dot gnu.org
2022-07-26  7:49 ` [Bug tree-optimization/106444] " rguenth at gcc dot gnu.org
2022-07-26  7:56 ` rguenth at gcc dot gnu.org
2022-07-26  8:29 ` aldyh at gcc dot gnu.org
2022-07-26  9:42 ` aldyh at gcc dot gnu.org
2022-07-26 11:07 ` cvs-commit at gcc dot gnu.org
2022-07-26 11:07 ` aldyh at gcc dot gnu.org
2022-08-08 18:43 ` 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).