[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-23 Thread pinskia at gcc dot gnu dot org


--- Comment #7 from pinskia at gcc dot gnu dot org  2008-12-23 16:21 ---
Fixed, thanks for the bug report.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-23 Thread pinskia at gcc dot gnu dot org


--- Comment #8 from pinskia at gcc dot gnu dot org  2008-12-23 16:22 ---
Subject: Bug 38590

Author: pinskia
Date: Tue Dec 23 16:21:32 2008
New Revision: 142906

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142906
Log:
2008-12-23  Andrew Pinski  pin...@gmail.com

PR middle-end/38590
* fold-const.c (fold_binary): Call fold_convert on arguments to
fold_build2 for negative divide optimization.

2008-12-23  Andrew Pinski  pins...@gmail.com

PR middle-end/38590
* gcc.c-torture/compile/pr38590-1.c: New testcase.
* gcc.c-torture/compile/pr38590-2.c: New testcase.


Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr38590-1.c
trunk/gcc/testsuite/gcc.c-torture/compile/pr38590-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-21 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2008-12-21 10:14 ---
This is caused by the optimization which converts C/-a into -C/a for strict
overflow which is why it only happens at -O2 and above (or with
-fstrict-overflow).

Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
  Component|c   |middle-end
 Ever Confirmed|0   |1
   Keywords||ice-checking, ice-on-valid-
   ||code
   Last reconfirmed|-00-00 00:00:00 |2008-12-21 10:14:51
   date||
Summary|ice: verify_gimple failed   |[4.4 Regression] ice:
   ||verify_gimple failed
   Target Milestone|--- |4.4.0
Version|unknown |4.4.0


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-21 Thread hjl dot tools at gmail dot com


--- Comment #2 from hjl dot tools at gmail dot com  2008-12-21 18:00 ---
It is caused by revision 133479:

http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01393.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||rguenther at suse dot de
  GCC build triplet|i686-pc-linux-gnu   |
   GCC host triplet|i686-pc-linux-gnu   |
 GCC target triplet|i686-pc-linux-gnu   |


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-21 Thread pinskia at gcc dot gnu dot org


--- Comment #3 from pinskia at gcc dot gnu dot org  2008-12-21 19:13 ---
(In reply to comment #2)
 It is caused by revision 133479:
 
 http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01393.html

Not really caused, just exposed, in fact it was caused by:
r107575 | pinskia | 2005-11-27 16:31:36 -0500 (Sun, 27 Nov 2005) | 13 lines

2005-11-27  Andrew Pinski  pins...@physics.uc.edu

PR middle-end/24575
* fold-const.c (negate_expr_p): Add case for signed divides if overflow
is undefined.
(negate_expr): Likewise.
2005-11-27  Andrew Pinski  pins...@physics.uc.edu

PR middle-end/24575
* gcc.dg/tree-ssa/divide-3.c: New test.
* gcc.dg/tree-ssa/divide-4.c: New test.

:)

Yes it is my bug.  See sometimes pointing out the patch which exposes the ICE
is not always correct as you need to look into what the patch is doing.  The
patch which HJL pointed out is just the patch which enables the checking and
not the patch which enabled the optimization in the first place.


-- 


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-21 Thread pinskia at gcc dot gnu dot org


--- Comment #4 from pinskia at gcc dot gnu dot org  2008-12-21 22:04 ---
Anyways I have a simple fix, just use fold_convert in some places in
fold-const.c for the folding of -A / -B into A/B.

Note it was really caused by:
r107543 | pinskia | 2005-11-26 17:18:04 -0500 (Sat, 26 Nov 2005) | 13 lines

2005-11-26  Andrew Pinski  pins...@physics.uc.edu

PR middle-end/23669
* fold-const.c (fold_binary): Convert -A/-B to A/B for signed types
when overflow is undefined.
2005-11-26  Andrew Pinski  pins...@physics.uc.edu

PR middle-end/23669
* gcc.dg/tree-ssa/divide-1.c: New test.
* gcc.dg/tree-ssa/divide-2.c: New test.

:)


-- 


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-21 Thread pinskia at gcc dot gnu dot org


--- Comment #6 from pinskia at gcc dot gnu dot org  2008-12-21 22:28 ---
Mine.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED


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



[Bug middle-end/38590] [4.4 Regression] ice: verify_gimple failed

2008-12-21 Thread pinskia at gcc dot gnu dot org


--- Comment #5 from pinskia at gcc dot gnu dot org  2008-12-21 22:16 ---
The obvious patch which I am testing right now:
Index: fold-const.c
===
--- fold-const.c(revision 142867)
+++ fold-const.c(working copy)
@@ -11678,7 +11678,7 @@ fold_binary (enum tree_code code, tree t
   WARN_STRICT_OVERFLOW_MISC);
  return fold_build2 (code, type,
  fold_convert (type, TREE_OPERAND (arg0, 0)),
- negate_expr (arg1));
+ fold_convert (type, negate_expr (arg1)));
}
   if ((!INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
   TREE_CODE (arg1) == NEGATE_EXPR
@@ -11689,8 +11689,9 @@ fold_binary (enum tree_code code, tree t
when distributing negation across 
division),
   WARN_STRICT_OVERFLOW_MISC);
- return fold_build2 (code, type, negate_expr (arg0),
- TREE_OPERAND (arg1, 0));
+ return fold_build2 (code, type,
+ fold_convert (type, negate_expr (arg0)),
+ fold_convert (type, TREE_OPERAND (arg1, 0)));
}

   /* If arg0 is a multiple of arg1, then rewrite to the fastest div


-- 


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