public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471
@ 2021-06-24  7:46 zhendong.su at inf dot ethz.ch
  2021-06-24  9:30 ` [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-06-24  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101189
           Summary: ICE at -Os and above on x86_64-linux-gnu: in
                    fold_cond, at vr-values.c:3471
           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: ---

[535] % 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/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210624 (experimental) [master revision
fcf617f0d2a:8f55dced666:3bd86940c428de9dde53e41265fb1435ed236f5e] (GCC)
[536] %
[536] % gcctk -O1 small.c; ./a.out
[537] %
[537] % gcctk -Os small.c
during GIMPLE pass: evrp
small.c: In function ‘main’:
small.c:13:1: internal compiler error: in fold_cond, at vr-values.c:3471
   13 | }
      | ^
0x1189432 simplify_using_ranges::fold_cond(gcond*)
        ../../gcc-trunk/gcc/vr-values.c:3470
0x1189465 simplify_using_ranges::simplify_cond_using_ranges_1(gcond*)
        ../../gcc-trunk/gcc/vr-values.c:3513
0x119194f simplify_using_ranges::simplify(gimple_stmt_iterator*)
        ../../gcc-trunk/gcc/vr-values.c:4229
0x184ffb8 hybrid_folder::fold_stmt(gimple_stmt_iterator*)
        ../../gcc-trunk/gcc/gimple-ssa-evrp.c:527
0xfa5116 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc-trunk/gcc/tree-ssa-propagate.c:870
0x1808717 dom_walker::walk(basic_block_def*)
        ../../gcc-trunk/gcc/domwalk.c:309
0xfa42d5 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        ../../gcc-trunk/gcc/tree-ssa-propagate.c:987
0x184f0ef execute_early_vrp
        ../../gcc-trunk/gcc/gimple-ssa-evrp.c:690
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.
[538] %
[538] % cat small.c
static int a, b;
int main() {
  int d = 0, e, f = 5;
  if (a)
    f = 0;
  for (; f < 4; f++)
    ;
  e = f ^ -f;
  e && d;
  if (!e)
    e || b;
  return 0;
}

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

* [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff
  2021-06-24  7:46 [Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 zhendong.su at inf dot ethz.ch
@ 2021-06-24  9:30 ` marxin at gcc dot gnu.org
  2021-06-24 19:15 ` amacleod at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-24  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
      Known to work|                            |11.1.0
      Known to fail|                            |12.0
            Version|unknown                     |12.0
                 CC|                            |amacleod at redhat dot com,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
            Summary|ICE at -Os and above on     |[12 Regression] ICE at -Os
                   |x86_64-linux-gnu: in        |and above on
                   |fold_cond, at               |x86_64-linux-gnu: in
                   |vr-values.c:3471            |fold_cond, at
                   |                            |vr-values.c:3471 since
                   |                            |r12-1721-ga2c9173331914eff
   Last reconfirmed|                            |2021-06-24
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r12-1721-ga2c9173331914eff.

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

* [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff
  2021-06-24  7:46 [Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 zhendong.su at inf dot ethz.ch
  2021-06-24  9:30 ` [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff marxin at gcc dot gnu.org
@ 2021-06-24 19:15 ` amacleod at redhat dot com
  2021-06-24 20:02 ` cvs-commit at gcc dot gnu.org
  2021-06-24 20:03 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: amacleod at redhat dot com @ 2021-06-24 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
We always register relations on outgoing edges from a conditional.
in this case
  _2 = -f_6;      //  f_6 was known to be [4,5]
  if (_2 == f_6)   // This this was known to fail because _2 was [-5, -4]
    goto <bb 8>; [INV]
  else
    goto <bb 10>; [INV]

  <bb 8> :
  if (_2 != f_6)     // which makes this unreachable code
    goto <bb 10>; [INV]
  else
    goto <bb 9>; [INV]

THe problem is we were registering _2 == f_6 as a relation on the edge 6->8
which would then make the condition on bb_8 false. 
We know that _2 != f_6, so the vrp folder was saying this branch was always
taken, and the relation code was prompted that its never taken :-P  Its an
unreachable branch, but it was adding an inconsitency.

Instead, if we know an edge cannot be taken, like 6->8, do not register a
relation on that edge.

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

* [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff
  2021-06-24  7:46 [Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 zhendong.su at inf dot ethz.ch
  2021-06-24  9:30 ` [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff marxin at gcc dot gnu.org
  2021-06-24 19:15 ` amacleod at redhat dot com
@ 2021-06-24 20:02 ` cvs-commit at gcc dot gnu.org
  2021-06-24 20:03 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-24 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:a0accaa99844b0c40661202635859f8c0be76cdd

commit r12-1797-ga0accaa99844b0c40661202635859f8c0be76cdd
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Jun 24 13:35:21 2021 -0400

    Only register relations on live edges

    Register a relation on a conditional edge only if the LHS supports
    this edge being taken.

            gcc/
            PR tree-optimization/101189
            * gimple-range-fold.cc (fold_using_range::range_of_range_op): Pass
            LHS range of condition to postfold routine.
            (fold_using_range::postfold_gcond_edges): Only process the TRUE or
            FALSE edge if the LHS range supports it being taken.
            * gimple-range-fold.h (postfold_gcond_edges): Add range parameter.

            gcc/testsuite/
            * gcc.dg/tree-ssa/pr101189.c: New.

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

* [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff
  2021-06-24  7:46 [Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2021-06-24 20:02 ` cvs-commit at gcc dot gnu.org
@ 2021-06-24 20:03 ` amacleod at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: amacleod at redhat dot com @ 2021-06-24 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

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:[~2021-06-24 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  7:46 [Bug tree-optimization/101189] New: ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 zhendong.su at inf dot ethz.ch
2021-06-24  9:30 ` [Bug tree-optimization/101189] [12 Regression] ICE at -Os and above on x86_64-linux-gnu: in fold_cond, at vr-values.c:3471 since r12-1721-ga2c9173331914eff marxin at gcc dot gnu.org
2021-06-24 19:15 ` amacleod at redhat dot com
2021-06-24 20:02 ` cvs-commit at gcc dot gnu.org
2021-06-24 20:03 ` 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).