This is the mail archive of the gcc-patches@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]

Re: [Bug tree-optimization/27364] [4.2 Regression] Gcc 4.2 miscompiles binutils


On Sun, 2006-04-30 at 18:21 +0000, pinskia at gcc dot gnu dot org wrote:
> 
> ------- Comment #10 from pinskia at gcc dot gnu dot org  2006-04-30 18:21 -------
> Here is the reduced testcase:
> int f(unsigned number_of_digits_to_use)
> {
>   if (number_of_digits_to_use >1294)
>     return 0;
>   return (number_of_digits_to_use * 3321928 / 1000000 + 1) /16;
> }
> 
> int main(void)
> {
>   if (f(11) != 2)
>     __builtin_abort ();
As discussed in the PR, the problem is we don't detect overflow
from MULT_EXPR correctly.  This causes us to get an incorrect
range which ultimately cascades into generating the wrong
return value.

This patch fixes the overflow detection for MULT_EXPR.  Bootstrapped
and regression tested on i686-pc-linux-gnu, both on the 4.1 branch
and mainline.


Attachment: PPP
Description: Text document


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