[PATCH] Document arithmetic overflow semantics

Robert Dewar dewar@gnat.com
Thu Feb 13 20:41:00 GMT 2003


> Are you really claiming that a program with an uninitialized variable
> must be compiled in such a way that it produces the same result independent
> of optimization?

No one claims this, but it is useful to observe that the problem of uninitialized
variables causing different results in unoptimized and optimized code is a severe
one in practice that causes a lot of grief, especially in large systems where
tracking down the difference can be a lot of work. However, in this case, the
cure would be very expensive, and the gain from "optimizing" (which typically
comes from putting stuff in registers) is so great as to be worth the pain.

But we really should note in this discussion that any case in which optimization
changes results is potentailly a degradation of the usability of the compiler.
You have to be careful, on a case-by-case basis, that the gains from the
corresponding optimization are worth the pain.



More information about the Gcc mailing list