public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
@ 2013-10-18  1:38 pinskia at gcc dot gnu.org
  2013-10-18  1:54 ` [Bug tree-optimization/58775] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-10-18  1:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

            Bug ID: 58775
           Summary: [4.9 Regression] reassoc1 causes an ICE with some bool
                    arithmetic
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: critical
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org

When I was trying to forward port my tree-ssa-ifcombine patch I ran into this
ICE.  At first I thought it was a bug in my code and then I looked into it
further and saw that I could reproduce it with a simple testcase on an
unmodified code.  This was found while building mpfr.

Testcase:
void __gmpfr_vasprintf (char * t)
{
  char _4;
  _Bool _5;
  _Bool _6;
  _Bool _7;
  _Bool _9;
  _Bool _10;
  _Bool _11;
  _Bool _12;
  _Bool _13;
  _Bool _14;
  _Bool _15;
  _Bool _16;
  _Bool _17;

  _4 = *t;
  _5 = _4 == 100;
  _6 = _4 == 105;
  _7 = _5 | _6;
  _9 = _4 != 111;
  _10 = !_7;
  _11 = _9 & _10;
  _13 = _4 != 117;
  _12 = _11 & _13;
  _14 = _4 != 120;
  _15 = _12 & _14;
  _16 = _4 != 88;
  _17 = _15 & _16;
  if (_17 == 0)
    f ();

  return;
}


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
@ 2013-10-18  1:54 ` pinskia at gcc dot gnu.org
  2013-10-18  5:25 ` zhenqiang.chen at linaro dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-10-18  1:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhenqiang.chen at linaro dot org
   Target Milestone|---                         |4.9.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this was introduced by:
2013-10-15  Zhenqiang Chen  <zhenqiang.chen@arm.com>

    * tree-ssa-reassoc.c: Include rtl.h and tm_p.h.
    (optimize_range_tests_1): New function,
    extracted from optimize_range_tests.
    (optimize_range_tests_xor): Similarly.
    (optimize_range_tests_diff): New function.
    (optimize_range_tests): Use optimize_range_tests_1.

Disabling both calls to optimize_range_tests_1 causes the testcase to pass.


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
  2013-10-18  1:54 ` [Bug tree-optimization/58775] " pinskia at gcc dot gnu.org
@ 2013-10-18  5:25 ` zhenqiang.chen at linaro dot org
  2013-10-18  6:55 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zhenqiang.chen at linaro dot org @ 2013-10-18  5:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

--- Comment #2 from zhenqiang.chen at linaro dot org ---
I can reproduce the ICE with "-O2".

And it failed before my patch.


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
  2013-10-18  1:54 ` [Bug tree-optimization/58775] " pinskia at gcc dot gnu.org
  2013-10-18  5:25 ` zhenqiang.chen at linaro dot org
@ 2013-10-18  6:55 ` pinskia at gcc dot gnu.org
  2013-10-18  7:03 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-10-18  6:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.7.0

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This works for sure in 4.7.0.


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-10-18  6:55 ` pinskia at gcc dot gnu.org
@ 2013-10-18  7:03 ` jakub at gcc dot gnu.org
  2013-10-18  7:04 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-10-18  7:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eraman at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
      Known to work|4.7.0                       |

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Caused by r199048.


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-10-18  7:03 ` jakub at gcc dot gnu.org
@ 2013-10-18  7:04 ` jakub at gcc dot gnu.org
  2013-10-18  8:18 ` zhenqiang.chen at linaro dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-10-18  7:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-18
      Known to work|                            |4.7.0, 4.8.2
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.0


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-10-18  7:04 ` jakub at gcc dot gnu.org
@ 2013-10-18  8:18 ` zhenqiang.chen at linaro dot org
  2013-10-23 16:19 ` jakub at gcc dot gnu.org
  2013-11-05 15:05 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: zhenqiang.chen at linaro dot org @ 2013-10-18  8:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

--- Comment #5 from zhenqiang.chen at linaro dot org ---
In r199048, it uses gimple_uid to check the "dominate" relation. But for
optimize_range_tests, we do not set gimple_uid for the new generated stmt.

I will work out a patch to fix it.


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-10-18  8:18 ` zhenqiang.chen at linaro dot org
@ 2013-10-23 16:19 ` jakub at gcc dot gnu.org
  2013-11-05 15:05 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-10-23 16:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Oct 23 16:19:17 2013
New Revision: 203979

URL: http://gcc.gnu.org/viewcvs?rev=203979&root=gcc&view=rev
Log:
    PR tree-optimization/58775
    PR tree-optimization/58791
    * tree-ssa-reassoc.c (reassoc_stmt_dominates_stmt_p): New function.
    (insert_stmt_after): Rewritten, don't move the stmt, but really
    insert it.
    (get_stmt_uid_with_default): Remove.
    (build_and_add_sum): Use insert_stmt_after and
    reassoc_stmt_dominates_stmt_p.  Fix up uid if bb contains only
    labels.
    (update_range_test): Set uid on stmts added by
    force_gimple_operand_gsi.  Don't immediately modify statements
    in inter-bb optimization, just update oe->op values.
    (optimize_range_tests): Return bool whether any changed have
    been made.
    (update_ops): New function.
    (struct inter_bb_range_test_entry): New type.
    (maybe_optimize_range_tests): Perform statement changes here.
    (not_dominated_by, appears_later_in_bb, get_def_stmt,
    ensure_ops_are_available): Remove.
    (find_insert_point): Rewritten.
    (rewrite_expr_tree): Remove MOVED argument, add CHANGED argument,
    return LHS of the (new resp. old) stmt.  Don't call
    ensure_ops_are_available, don't reuse SSA_NAMEs, recurse first
    instead of last, move new stmt at the right place.
    (linearize_expr, repropagate_negates): Don't reuse SSA_NAMEs.
    (negate_value): Likewise.  Set uids.
    (break_up_subtract_bb): Initialize uids.
    (reassociate_bb): Adjust rewrite_expr_tree caller.
    (do_reassoc): Don't call renumber_gimple_stmt_uids.

    * gcc.dg/guality/pr58791-1.c: New test.
    * gcc.dg/guality/pr58791-2.c: New test.
    * gcc.dg/guality/pr58791-3.c: New test.
    * gcc.dg/guality/pr58791-4.c: New test.
    * gcc.dg/guality/pr58791-5.c: New test.
    * gcc.c-torture/compile/pr58775.c: New test.
    * gcc.dg/tree-ssa/reassoc-28.c: Don't scan reassoc1 dump.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr58775.c
    trunk/gcc/testsuite/gcc.dg/guality/pr58791-1.c
    trunk/gcc/testsuite/gcc.dg/guality/pr58791-2.c
    trunk/gcc/testsuite/gcc.dg/guality/pr58791-3.c
    trunk/gcc/testsuite/gcc.dg/guality/pr58791-4.c
    trunk/gcc/testsuite/gcc.dg/guality/pr58791-5.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tree-ssa/reassoc-28.c
    trunk/gcc/tree-ssa-reassoc.c


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

* [Bug tree-optimization/58775] [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic
  2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-10-23 16:19 ` jakub at gcc dot gnu.org
@ 2013-11-05 15:05 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-05 15:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58775

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

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Assuming fixed.


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

end of thread, other threads:[~2013-11-05 15:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-18  1:38 [Bug tree-optimization/58775] New: [4.9 Regression] reassoc1 causes an ICE with some bool arithmetic pinskia at gcc dot gnu.org
2013-10-18  1:54 ` [Bug tree-optimization/58775] " pinskia at gcc dot gnu.org
2013-10-18  5:25 ` zhenqiang.chen at linaro dot org
2013-10-18  6:55 ` pinskia at gcc dot gnu.org
2013-10-18  7:03 ` jakub at gcc dot gnu.org
2013-10-18  7:04 ` jakub at gcc dot gnu.org
2013-10-18  8:18 ` zhenqiang.chen at linaro dot org
2013-10-23 16:19 ` jakub at gcc dot gnu.org
2013-11-05 15:05 ` rguenth 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).