how to make gcc warn about arithmetic signed overflow

Jonathan Wakely
Sun Sep 22 15:52:00 GMT 2013

On 21 September 2013 20:33,  <> wrote:
> But compiler also knows the operand values even if they are not
> constant? These values must be known to produce the multiplication
> result.

No, in general the processor produces the result of multiplying two
variables, not the compiler.

> Is this warning produced only when two operands are constant
> and optimization is turned on because this is just the way gcc does it
> and the warnings could also be produced for non-const operands if a
> compiler worked in a different way?

Yes, Marc and I have both said that, please read our replies more carefully.

More information about the Gcc-help mailing list