public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111355] New: ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078
@ 2023-09-09 11:49 zhendong.su at inf dot ethz.ch
  2023-09-09 15:59 ` [Bug tree-optimization/111355] [14 Regression] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2023-09-09 11:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111355
           Summary: ICE on valid code at -O1 and above: in lower_bound, at
                    value-range.h:1078
           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: ---

This appears to be a recent regression.

Compiler Explorer: https://godbolt.org/z/rPvxdPsE4

[519] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.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
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230909 (experimental) (GCC) 
[520] % 
[520] % gcctk -O1 -w small.c
during GIMPLE pass: ccp
small.c: In function ‘main’:
small.c:4:1: internal compiler error: in lower_bound, at value-range.h:1078
    4 | }
      | ^
0xd3617e irange::lower_bound(unsigned int) const
        ../../gcc-trunk/gcc/value-range.h:1078
0xd3617e irange::lower_bound(unsigned int) const
        ../../gcc-trunk/gcc/value-range.h:1076
0x161e375 gimple_simplify_TRUNC_DIV_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
        /local/suz-local/software/gccbuild/objdir/gcc/gimple-match-7.cc:8473
0x173a4c6 gimple_resimplify2
        ../../gcc-trunk/gcc/gimple-match-exports.cc:1001
0x173af60 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        ../../gcc-trunk/gcc/gimple-match-exports.cc:868
0xca44fc gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
        ../../gcc-trunk/gcc/gimple-fold.cc:7545
0x112da22 ccp_fold
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:1288
0x112da22 evaluate_stmt
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:2225
0x112f3f5 visit_assignment
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:2859
0x11e2f1a ssa_propagation_engine::simulate_stmt(gimple*)
        ../../gcc-trunk/gcc/tree-ssa-propagate.cc:221
0x11e322a ssa_propagation_engine::simulate_block(basic_block_def*)
        ../../gcc-trunk/gcc/tree-ssa-propagate.cc:328
0x11e3633 ssa_propagation_engine::ssa_propagate()
        ../../gcc-trunk/gcc/tree-ssa-propagate.cc:478
0x1125230 do_ssa_ccp
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:2978
0x1125230 execute
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:3024
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.
[521] % 
[521] % cat small.c
int main() {
  unsigned b;
  return b ? 1 << --b / 0 : 0;
}

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

* [Bug tree-optimization/111355] [14 Regression] ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078
  2023-09-09 11:49 [Bug tree-optimization/111355] New: ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078 zhendong.su at inf dot ethz.ch
@ 2023-09-09 15:59 ` pinskia at gcc dot gnu.org
  2023-09-09 16:04 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-09 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug tree-optimization/111355] [14 Regression] ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078
  2023-09-09 11:49 [Bug tree-optimization/111355] New: ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078 zhendong.su at inf dot ethz.ch
  2023-09-09 15:59 ` [Bug tree-optimization/111355] [14 Regression] " pinskia at gcc dot gnu.org
@ 2023-09-09 16:04 ` pinskia at gcc dot gnu.org
  2023-09-19 16:03 ` zhendong.su at inf dot ethz.ch
  2023-09-21  5:18 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-09 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Same issue as PR 111303 .

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

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

* [Bug tree-optimization/111355] [14 Regression] ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078
  2023-09-09 11:49 [Bug tree-optimization/111355] New: ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078 zhendong.su at inf dot ethz.ch
  2023-09-09 15:59 ` [Bug tree-optimization/111355] [14 Regression] " pinskia at gcc dot gnu.org
  2023-09-09 16:04 ` pinskia at gcc dot gnu.org
@ 2023-09-19 16:03 ` zhendong.su at inf dot ethz.ch
  2023-09-21  5:18 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2023-09-19 16:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
It seems that the fix for PR 111303 did not fix this ICE.

[511] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.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
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230919 (experimental) (GCC) 
[512] % 
[512] % gcctk -O1 small.c 
small.c: In function ‘main’:
small.c:3:23: warning: division by zero [-Wdiv-by-zero]
    3 |   return b ? 1 << --b / 0 : 0;
      |                       ^
during GIMPLE pass: ccp
small.c:4:1: internal compiler error: in lower_bound, at value-range.h:1078
    4 | }
      | ^
0x9293e1 irange::lower_bound(unsigned int) const
        ../../gcc-trunk/gcc/value-range.h:1078
0x9293e1 irange::lower_bound(unsigned int) const
        ../../gcc-trunk/gcc/value-range.h:1076
0x9293e1 gimple_simplify_TRUNC_DIV_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
        /local/suz-local/software/gccbuild/objdir/gcc/gimple-match-4.cc:8423
0x1646816 gimple_resimplify2
        ../../gcc-trunk/gcc/gimple-match-exports.cc:1001
0x16472b0 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
        ../../gcc-trunk/gcc/gimple-match-exports.cc:868
0xca6c5c gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
        ../../gcc-trunk/gcc/gimple-fold.cc:7545
0x11316f2 ccp_fold
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:1288
0x11316f2 evaluate_stmt
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:2225
0x11330c5 visit_assignment
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:2859
0x11e705a ssa_propagation_engine::simulate_stmt(gimple*)
        ../../gcc-trunk/gcc/tree-ssa-propagate.cc:221
0x11e736a ssa_propagation_engine::simulate_block(basic_block_def*)
        ../../gcc-trunk/gcc/tree-ssa-propagate.cc:328
0x11e7773 ssa_propagation_engine::ssa_propagate()
        ../../gcc-trunk/gcc/tree-ssa-propagate.cc:478
0x1128f00 do_ssa_ccp
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:2978
0x1128f00 execute
        ../../gcc-trunk/gcc/tree-ssa-ccp.cc:3024
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.
[513] % 
[513] % cat small.c 
int main() {
  unsigned b;
  return b ? 1 << --b / 0 : 0;
}

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

* [Bug tree-optimization/111355] [14 Regression] ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078
  2023-09-09 11:49 [Bug tree-optimization/111355] New: ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2023-09-19 16:03 ` zhendong.su at inf dot ethz.ch
@ 2023-09-21  5:18 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-21  5:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jiu Fu Guo <guojiufu@gcc.gnu.org>:

https://gcc.gnu.org/g:4d80863d7f93c0a839d1fe5dc59be83153e89110

commit r14-4192-g4d80863d7f93c0a839d1fe5dc59be83153e89110
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Wed Sep 20 11:11:58 2023 +0800

    check undefine_p for one more vr

    The root cause of PR111355 and PR111482 is missing to check if vr0
    is undefined_p before call vr0.lower_bound.

    In the pattern "(X + C) / N",

        (if (INTEGRAL_TYPE_P (type)
             && get_range_query (cfun)->range_of_expr (vr0, @0))
         (if (...)
           (plus (op @0 @2) { wide_int_to_tree (type, plus_op1 (c)); })
           (if (TYPE_UNSIGNED (type) && c.sign_mask () < 0 ...
                && wi::geu_p (vr0.lower_bound (), -c))

    In "(if (...)", there is code to prevent vr0's undefined_p,
    But in the "else" part, vr0's undefined_p is not checked before
    "wi::geu_p (vr0.lower_bound (), -c)".

            PR tree-optimization/111355

    gcc/ChangeLog:

            * match.pd ((X + C) / N): Update pattern.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr111355.c: New test.

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

end of thread, other threads:[~2023-09-21  5:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-09 11:49 [Bug tree-optimization/111355] New: ICE on valid code at -O1 and above: in lower_bound, at value-range.h:1078 zhendong.su at inf dot ethz.ch
2023-09-09 15:59 ` [Bug tree-optimization/111355] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-09 16:04 ` pinskia at gcc dot gnu.org
2023-09-19 16:03 ` zhendong.su at inf dot ethz.ch
2023-09-21  5:18 ` cvs-commit 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).