This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/22230] [4.1 Regression] value range propagation error


------- Additional Comments From steven at gcc dot gnu dot org  2005-07-14 17:02 -------
The bug is that the 4 cross operations are not computed properly.  In 
extract_range_from_binary_expr we compute them as follows: 
 
      /* Compute the 4 cross operations.  */ 
      val[0] = vrp_int_const_binop (code, vr0.min, vr1.min); 
 
      val[1] = (vr1.max != vr1.min) 
               ? vrp_int_const_binop (code, vr0.min, vr1.max) 
               : NULL_TREE; 
 
      val[2] = (vr0.max != vr0.min) 
               ? vrp_int_const_binop (code, vr0.max, vr1.min) 
               : NULL_TREE; 
 
      val[3] = (vr0.min != vr1.min && vr0.max != vr1.max) 
               ? vrp_int_const_binop (code, vr0.max, vr1.max) 
               : NULL_TREE; 
 
We compute this for "i*i" so vr0.min == vr1.min and vr0.max == vr1.max,  
because vr0 and vr1 are the same (both are the range for i, which is [0,4] 
at this point). 
 
We end up with: 
val[0] = <integer_cst type <integer_type "long int"> constant invariant 0> 
val[1] = <integer_cst type <integer_type "long int"> constant invariant 0> 
val[2] = <integer_cst type <integer_type "long int"> constant invariant 0> 
val[3] = NULL_TREE 
 
Obviously we derive that the new range for "i*i" must be "0" from these 
incorrect val[] results. 
 

-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]