public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621
@ 2022-10-01 14:19 zhendong.su at inf dot ethz.ch
  2022-10-02 11:58 ` [Bug tree-optimization/107109] " zhendong.su at inf dot ethz.ch
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-10-01 14:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107109
           Summary: ICE on valid code at -O1 on x86_64-linux-gnu: in type,
                    at value-range.h:621
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a recent regression. 

Compiler Explorer: https://godbolt.org/z/891T9sGeP

[505] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954] (GCC) 
[506] % 
[506] % gcctk -O1 small.c
during GIMPLE pass: dom
small.c: In function ‘c’:
small.c:3:6: internal compiler error: in type, at value-range.h:621
    3 | void c() {
      |      ^
0x85da64 irange::type() const
        ../../gcc-trunk/gcc/value-range.h:621
0x85e6e1 irange::type() const
        ../../gcc-trunk/gcc/tree.h:3634
0x85e6e1 adjust_op1_for_overflow
        ../../gcc-trunk/gcc/range-op.cc:1373
0x1de41b6 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
        ../../gcc-trunk/gcc/range-op.cc:1414
0x1de41b6 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
        ../../gcc-trunk/gcc/range-op.cc:1400
0x1ce84f5 gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1086
0x1ce7b6d gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ce856f gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7b6d gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ceaf68 gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1358
0x1cdb605 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1494
0x1cdb991 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1398
0x1cdb991 ranger_cache::entry_range(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:928
0x1cdb991 ranger_cache::entry_range(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:916
0x1cdba48 ranger_cache::edge_range(vrange&, edge_def*, tree_node*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:959
0x1cdb005 ranger_cache::resolve_dom(vrange&, tree_node*, basic_block_def*)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1384
0x1cdb660 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1488
0x1cdd392 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1398
0x1cdd392 ranger_cache::fill_block_cache(tree_node*, basic_block_def*,
basic_block_def*)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1212
0x1cddfd4 ranger_cache::block_range(vrange&, basic_block_def*, tree_node*,
bool)
        ../../gcc-trunk/gcc/gimple-range-cache.cc:1039
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.
[507] % 
[507] % cat small.c
int printf(const char *, ...);
int a, b;
void c() {
  int d, e;
 L:
  a = (b && a) ^ 2756578370;
  d = ~a + (e ^ d) ^ 2756578370;
  if (!d)
    printf("%d", a);
  d = a / e;
  goto L;
}
int main() {
  if (a)
    c();
  return 0;
}

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

* [Bug tree-optimization/107109] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621
  2022-10-01 14:19 [Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 zhendong.su at inf dot ethz.ch
@ 2022-10-02 11:58 ` zhendong.su at inf dot ethz.ch
  2022-10-03  9:27 ` [Bug tree-optimization/107109] [13 Regression] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 since r13-2975-g7ea258a13a115e9e marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-10-02 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another test that only reproduces at -O2 and -O3.

[508] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221002 (experimental) [master r13-3015-g3290dcf1499] (GCC) 
[509] % 
[509] % gcctk -O1 small.c; ./a.out
[510] % 
[510] % gcctk -O2 small.c
during GIMPLE pass: dom
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in type, at value-range.h:621
    2 | int main() {
      |     ^~~~
0x85dab4 irange::type() const
        ../../gcc-trunk/gcc/value-range.h:621
0x85e731 irange::type() const
        ../../gcc-trunk/gcc/tree.h:3634
0x85e731 adjust_op1_for_overflow
        ../../gcc-trunk/gcc/range-op.cc:1373
0x1de43e3 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
        ../../gcc-trunk/gcc/range-op.cc:1414
0x1de43e3 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
        ../../gcc-trunk/gcc/range-op.cc:1400
0x1de43e3 operator_plus::op2_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
        ../../gcc-trunk/gcc/range-op.cc:1424
0x1ce8e58 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1182
0x1ce7435 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:694
0x1ce85df gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7bdd gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ce8ed0 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1228
0x1ce7435 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:694
0x1ce7209 gori_compute::compute_logical_operands(vrange&, vrange&,
gimple_range_op_handler&, irange const&, tree_node*, fur_source&, tree_node*,
bool)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:913
0x1ce7aae gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:674
0x1ce85df gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7bdd gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ceafd8 gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
        ../../gcc-trunk/gcc/gimple-range-gori.cc:1358
0x10a218d path_range_query::compute_ranges_in_block(basic_block_def*)
        ../../gcc-trunk/gcc/gimple-range-path.cc:454
0x10a2882 path_range_query::compute_ranges(bitmap_head const*)
        ../../gcc-trunk/gcc/gimple-range-path.cc:622
0x112dd90 hybrid_jt_simplifier::simplify(gimple*, gimple*, basic_block_def*,
jt_state*)
        ../../gcc-trunk/gcc/tree-ssa-threadedge.cc:1418
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.
[511] % 
[511] % cat small.c
int a, b = 1, c;
int main() {
  if (b <= 0) {
    if (a)
    L:
      if (b && a <= 600000000)
        b = c;
    int e = ~(a + b);
    if ((b <= e || a > e) && a)
      a = 0;
    if (b < 0)
      goto L;
    if (b >= a)
      while (1)
        ;
  }
  return 0;
}

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

* [Bug tree-optimization/107109] [13 Regression] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 since r13-2975-g7ea258a13a115e9e
  2022-10-01 14:19 [Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 zhendong.su at inf dot ethz.ch
  2022-10-02 11:58 ` [Bug tree-optimization/107109] " zhendong.su at inf dot ethz.ch
@ 2022-10-03  9:27 ` marxin at gcc dot gnu.org
  2022-10-03 14:14 ` cvs-commit at gcc dot gnu.org
  2022-10-03 14:15 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-03  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE on valid code at -O1 on |[13 Regression] ICE on
                   |x86_64-linux-gnu: in type,  |valid code at -O1 on
                   |at value-range.h:621        |x86_64-linux-gnu: in type,
                   |                            |at value-range.h:621 since
                   |                            |r13-2975-g7ea258a13a115e9e
   Target Milestone|---                         |13.0
            Version|unknown                     |13.0
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-10-03

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-2975-g7ea258a13a115e9e.

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

* [Bug tree-optimization/107109] [13 Regression] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 since r13-2975-g7ea258a13a115e9e
  2022-10-01 14:19 [Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 zhendong.su at inf dot ethz.ch
  2022-10-02 11:58 ` [Bug tree-optimization/107109] " zhendong.su at inf dot ethz.ch
  2022-10-03  9:27 ` [Bug tree-optimization/107109] [13 Regression] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 since r13-2975-g7ea258a13a115e9e marxin at gcc dot gnu.org
@ 2022-10-03 14:14 ` cvs-commit at gcc dot gnu.org
  2022-10-03 14:15 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-03 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:

https://gcc.gnu.org/g:f41d1b39a6443fad38c36af34b1baa384954ca80

commit r13-3031-gf41d1b39a6443fad38c36af34b1baa384954ca80
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Sun Oct 2 18:43:35 2022 -0400

    Don't process undefined range.

    No need to continue processing an undefined range.

            gcc/
            PR tree-optimization/107109
            * range-op.cc (adjust_op1_for_overflow): Don't process undefined.
            gcc/testsuite/
            * gcc.dg/pr107109.c: New.

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

* [Bug tree-optimization/107109] [13 Regression] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 since r13-2975-g7ea258a13a115e9e
  2022-10-01 14:19 [Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2022-10-03 14:14 ` cvs-commit at gcc dot gnu.org
@ 2022-10-03 14:15 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: amacleod at redhat dot com @ 2022-10-03 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

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

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
fixed.

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

end of thread, other threads:[~2022-10-03 14:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-01 14:19 [Bug tree-optimization/107109] New: ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 zhendong.su at inf dot ethz.ch
2022-10-02 11:58 ` [Bug tree-optimization/107109] " zhendong.su at inf dot ethz.ch
2022-10-03  9:27 ` [Bug tree-optimization/107109] [13 Regression] ICE on valid code at -O1 on x86_64-linux-gnu: in type, at value-range.h:621 since r13-2975-g7ea258a13a115e9e marxin at gcc dot gnu.org
2022-10-03 14:14 ` cvs-commit at gcc dot gnu.org
2022-10-03 14:15 ` amacleod at redhat dot com

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).