This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Should GCC publish a general rule/warning due to it's defaultpresumption of undefined signed integer overflow semantics?
On Fri, 2005-07-01 at 03:39 +0200, Gabriel Dos Reis wrote:
> Joe Buck <Joe.Buck@synopsys.COM> writes:
>
> | On Thu, Jun 30, 2005 at 09:02:48PM -0400, Andrew Pinski wrote:
> | > But the reason question is why make it an undefined behavior instead of
> | > an implementation defined? This would have made it clearer instead of
> | > allowing the compiler not document what happens. Or is C++
> | > just following C here? In which case it might be better to ask the C
> | > committee why it was done this way and real definition of undefined for
> | > this case?
> |
> | I already showed you the answer: loop optimization works better if you
> | can ignore overflow.
>
> There are various ways to work within "loop optimization" assumptions.
Gaby, if you have plans to do what nobody else has had any real luck
doing for 10 years in compilers in any practical way, which is proving
the iteration count of loops in the presence of overflow, please share.
It's possible, but all methods i'm aware that even attempt it are
incredibly expensive (exponential) in every case.
This isn't about SPEC numbers, it's about every single piece of
Numerical C, Fortran, and C++ i've ever seen.
--Dan