This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Document arithmetic overflow semantics
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: roger at www dot eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Thu, 13 Feb 03 10:58:18 EST
- Subject: Re: [PATCH] Document arithmetic overflow semantics
The issue is GCC's internal representations, which shouldn't suffer
from the same issue of poorly defined languages. Hence, if CSE sees
"x = i++; i = x" it had better understand exactly what "i = i++" means
at the RTL-level. One might hope that the interpretation of RTL and
TREEs are independent of the source language and target architecture.
I agree. Which is why I'm in favor of adding flags to tree nodes that say
whether the operation:
(a) has undefined behavior
(b) has defined overflow behavior, documented for the tree node in question
(c) will trap on overflow.
Then each language sets the appropriate bit for each expression it
makes (possibly defaulting to those from the types) and we do our best
to honor them.