This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Sat, 1 Mar 2008, Richard Kenner wrote:
int f(int a, int b) { return 0 * (a + b); }Why? Is there any language that requires such semantics?
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.
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.
And anyway, no point in doing energetic exergesis on vague language defining an option that has never worked anyway :-)
Part of "fixing" -ftrapv should be to carefully document exactly what it does/is-intended-to-do (hopefully those are the same :-))
Richard.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |