[Bug tree-optimization/56478] [4.8 Regression] ICE: Floating point exception in tree_estimate_probability

2013-03-08 Thread mpolacek at gcc dot gnu.org


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



--- Comment #5 from Marek Polacek mpolacek at gcc dot gnu.org 2013-03-08 
14:41:20 UTC ---

Author: mpolacek

Date: Fri Mar  8 14:41:14 2013

New Revision: 196547



URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=196547

Log:

PR tree-optimization/56478

* predict.c (is_comparison_with_loop_invariant_p): Change the 

type of loop_step to tree.

(predict_loops): Adjust.

(predict_iv_comparison): Perform the computations on double_ints.



Added:

trunk/gcc/testsuite/gcc.dg/torture/pr56478.c

Modified:

trunk/gcc/ChangeLog

trunk/gcc/predict.c

trunk/gcc/testsuite/ChangeLog


[Bug tree-optimization/56478] [4.8 Regression] ICE: Floating point exception in tree_estimate_probability

2013-03-08 Thread mpolacek at gcc dot gnu.org


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



Marek Polacek mpolacek at gcc dot gnu.org changed:



   What|Removed |Added



 Status|ASSIGNED|RESOLVED

 Resolution||FIXED



--- Comment #6 from Marek Polacek mpolacek at gcc dot gnu.org 2013-03-08 
14:42:10 UTC ---

Fixed.


[Bug tree-optimization/56478] [4.8 Regression] ICE: Floating point exception in tree_estimate_probability

2013-02-28 Thread jakub at gcc dot gnu.org


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



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 CC||dehao at gcc dot gnu.org



--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-28 
08:05:03 UTC ---

loop_bound = compare_bound = 0

base = -9223372036854775808

so

HOST_WIDE_INT loop_count = (loop_bound - base) / compare_step;

first invokes undefined behavior (loop_bound - base) computation and then

-LONG_LONG_MIN / -1 SIGFPEs.

That and the following code is just full of many potential undefined behaviors.

Even the compare_count++ or loop_count++ could trigger that.


[Bug tree-optimization/56478] [4.8 Regression] ICE: Floating point exception in tree_estimate_probability

2013-02-28 Thread jakub at gcc dot gnu.org


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



--- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-28 
08:15:19 UTC ---

There are other issues, like e.g. using int type to store step, with:

  if (host_integerp (iv0.step, 0))

step = tree_low_cst (iv0.step, 0);

guard for that.  host_integerp checks if the value fits into singed

HOST_WIDE_INT, not int, so if the step will be 0x123ULL, you'll happily

set step to 0, then divide by zero, etc.

I'd say safest would be to store step as tree (just verify it is INTEGER_CST),

and do all the arithmetics on trees, then look if we could fold it into a

non-TREE_OVERFLOW constant.


[Bug tree-optimization/56478] [4.8 Regression] ICE: Floating point exception in tree_estimate_probability

2013-02-28 Thread mpolacek at gcc dot gnu.org


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



Marek Polacek mpolacek at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |ASSIGNED

 AssignedTo|unassigned at gcc dot   |mpolacek at gcc dot gnu.org

   |gnu.org |



--- Comment #4 from Marek Polacek mpolacek at gcc dot gnu.org 2013-02-28 
13:53:54 UTC ---

On it.


[Bug tree-optimization/56478] [4.8 Regression] ICE: Floating point exception in tree_estimate_probability

2013-02-27 Thread jakub at gcc dot gnu.org


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



Jakub Jelinek jakub at gcc dot gnu.org changed:



   What|Removed |Added



 Status|UNCONFIRMED |NEW

   Last reconfirmed||2013-02-28

 CC||jakub at gcc dot gnu.org

   Target Milestone|--- |4.8.0

Summary|Regression: ICE: Floating   |[4.8 Regression] ICE:

   |point exception in  |Floating point exception in

   |tree_estimate_probability   |tree_estimate_probability

 Ever Confirmed|0   |1



--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org 2013-02-28 
07:52:24 UTC ---

Slightly cleaned up testcase:

int a;



void

foo ()

{

  int b;

  for (b = 0;; b++)

a = 0  -__LONG_LONG_MAX__ - 1 - b ? : 0;

}



Started with http://gcc.gnu.org/viewcvs?root=gccview=revrev=187277