public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385
@ 2021-05-27  5:20 cnsun at uwaterloo dot ca
  2021-05-27 14:18 ` [Bug c/100790] " marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-27  5:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100790
           Summary: ICE with -O2: in verify_range, at value-range.cc:385
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210527 (experimental) [master revision
:d03f010a0:01c59ef2e5a59b44d2b662361196abb6be872a20] (GCC)

$ cat mutant.c
__builtin_clz(int x) { x ? __builtin_clz(x) : 32; }

$ gcc-trunk -O2 mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | __builtin_clz(int x) { x ? __builtin_clz(x) : 32; }
      | ^~~~~~~~~~~~~
during GIMPLE pass: evrp
mutant.c: In function ‘__builtin_clz’:
mutant.c:1:1: internal compiler error: in verify_range, at value-range.cc:385
0x7d4aa5 irange::verify_range()
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/value-range.cc:385
0xc18ef7 fold_using_range::range_of_builtin_call(irange&, gcall*, fur_source&)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-range.cc:799
0xc1a6aa fold_using_range::range_of_call(irange&, gcall*, fur_source&)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-range.cc:626
0xc1ad40 fold_using_range::fold_stmt(irange&, gimple*, fur_source&, tree_node*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-range.cc:380
0xc1afc2 gimple_ranger::fold_range_internal(irange&, gimple*, tree_node*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-range.cc:1067
0xc1afc2 gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-range.cc:1097
0xc1a417 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-range.cc:980
0x12481b4 range_query::value_of_expr(tree_node*, gimple*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/value-query.cc:86
0x1962865 hybrid_folder::value_of_expr(tree_node*, gimple*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-ssa-evrp.c:233
0x10e1e06 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/tree-ssa-propagate.c:816
0x1935277 dom_walker::walk(basic_block_def*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/domwalk.c:309
0x10e10f9 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/tree-ssa-propagate.c:987
0x196244d execute_early_vrp
        /tmp/tmp.SQC1E9RsGE-gcc-builder/gcc/gcc/gimple-ssa-evrp.c:347
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] 6+ messages in thread

* [Bug c/100790] ICE with -O2: in verify_range, at value-range.cc:385
  2021-05-27  5:20 [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385 cnsun at uwaterloo dot ca
@ 2021-05-27 14:18 ` marxin at gcc dot gnu.org
  2021-05-27 14:29 ` aldyh at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-05-27 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-05-27
                 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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-4532-g054d7b9f6f6816a8.

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

* [Bug c/100790] ICE with -O2: in verify_range, at value-range.cc:385
  2021-05-27  5:20 [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385 cnsun at uwaterloo dot ca
  2021-05-27 14:18 ` [Bug c/100790] " marxin at gcc dot gnu.org
@ 2021-05-27 14:29 ` aldyh at gcc dot gnu.org
  2021-06-17 10:13 ` [Bug tree-optimization/100790] " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-05-27 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
There's a patch pending review that fixes this:

https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570289.html

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

* [Bug tree-optimization/100790] ICE with -O2: in verify_range, at value-range.cc:385
  2021-05-27  5:20 [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385 cnsun at uwaterloo dot ca
  2021-05-27 14:18 ` [Bug c/100790] " marxin at gcc dot gnu.org
  2021-05-27 14:29 ` aldyh at gcc dot gnu.org
@ 2021-06-17 10:13 ` cvs-commit at gcc dot gnu.org
  2021-06-17 10:14 ` aldyh at gcc dot gnu.org
  2021-06-17 10:14 ` aldyh at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-17 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:f1555d4013ed3cae2589270436387063d1c2f1a3

commit r12-1562-gf1555d4013ed3cae2589270436387063d1c2f1a3
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu May 13 13:47:41 2021 -0400

    Cleanup clz and ctz code in range_of_builtin_call.

    These are various cleanups to the clz/ctz code.

    First, ranges from range_of_expr are always numeric so we
    should adjust.  Also, the checks for non-zero were assuming the argument
    was unsigned, which in the PR's testcase is clearly not.  I've cleaned
    this up, so that it works either way.

    I've also removed the following annoying idiom:

    -         int newmini = prec - 1 - wi::floor_log2 (r.upper_bound ());
    -         if (newmini == prec)

    This is really a check for r.upper_bound() == 0, as floor_log2(0)
    returns -1.  It's confusing.

    Tested on x86-64 Linux.

    gcc/ChangeLog:

            PR tree-optimization/100790
            * gimple-range.cc (range_of_builtin_call): Cleanup clz and ctz
            code.

    gcc/testsuite/ChangeLog:

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

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

* [Bug tree-optimization/100790] ICE with -O2: in verify_range, at value-range.cc:385
  2021-05-27  5:20 [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385 cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2021-06-17 10:13 ` [Bug tree-optimization/100790] " cvs-commit at gcc dot gnu.org
@ 2021-06-17 10:14 ` aldyh at gcc dot gnu.org
  2021-06-17 10:14 ` aldyh at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-06-17 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

* [Bug tree-optimization/100790] ICE with -O2: in verify_range, at value-range.cc:385
  2021-05-27  5:20 [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385 cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2021-06-17 10:14 ` aldyh at gcc dot gnu.org
@ 2021-06-17 10:14 ` aldyh at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-06-17 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
...and closed.

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

end of thread, other threads:[~2021-06-17 10:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27  5:20 [Bug c/100790] New: ICE with -O2: in verify_range, at value-range.cc:385 cnsun at uwaterloo dot ca
2021-05-27 14:18 ` [Bug c/100790] " marxin at gcc dot gnu.org
2021-05-27 14:29 ` aldyh at gcc dot gnu.org
2021-06-17 10:13 ` [Bug tree-optimization/100790] " cvs-commit at gcc dot gnu.org
2021-06-17 10:14 ` aldyh at gcc dot gnu.org
2021-06-17 10:14 ` 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).