Re: Question on signed overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/18/2010 12:00 PM, Georg Lay wrote:
> Andrew Haley schrieb:
>> On 06/18/2010 10:11 AM, Georg Lay wrote:
>> What does -fdump-tree-optimized look like?
> 
> It looks almost as yours:
> 
> ;; Function abssat2 (abssat2)
> 
> Analyzing Edge Insertions.
> abssat2 (int x)
> {
>   unsigned int y;
> 
> <bb 2>:
>   y = (unsigned int) x;
>   if (x < 0)
>     goto <bb 3>;
>   else
>     goto <bb 4>;
> 
> <bb 3>:
>   y = -y;
> 
> <bb 4>:

Here may be a bug.  That's an integer overflow on unsigned-signed conversion:

>   if ((int) y < 0)
>     goto <bb 5>;
>   else
>     goto <bb 6>;
> 
> <bb 5>:
>   y = y + 0x0ffffffff;
> 
> <bb 6>:
>   return (int) y;
> 
> }

I still think that the fact that you get an incorrect overflow warning
but I don't is really important.  If we can find out why, I think that
may point to the real problem.

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux