This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][4.3] Deprecate -ftrapv
On Sat, 1 Mar 2008, Richard Kenner wrote:
> > int f(int a, int b) { return 0 * (a + b); }
> >
> > get the potentially trapping arithmetic folded away. If -ftrapv is to
> > have properly defined semantics, those must include trapping if (a + b)
> > overflows in the above code.
>
> Why? Is there any language that requires such semantics?
Not exactly. -ftrapv semantics are defined _very_ sparsely.
"This option generates traps for signed overflow on addition,
subtraction and multiplication operations."
it doesn't say if it preserves traps on dead code, so Josephs
interpretation is one possible valid one.
Richard.