Re: how to make gcc warn about arithmetic signed overflow

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

 



On 09/23/2013 08:38 PM, Dave Allured - NOAA Affiliate wrote:
> I believe the CPU overflow flag is updated after most integer
> arithmetic instructions.  Does GCC have any facility for checking this
> flag after each integer operation?  This would be a runtime check, of
> course, not a compile time check.

It wouldn't help with optimized code.  GCC reorganizes code, and it
assumes that overflow doesn't happen.  GCC inserts some arithmetic
instructions while optimizing and deletes others.  So, even if an
overflow happens in your code, it doesn't necessarily happen at
runtime.

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