This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Document arithmetic overflow semantics
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, <gcc at gcc dot gnu dot org>
- Date: Thu, 13 Feb 2003 08:22:27 -0700 (MST)
- Subject: Re: [PATCH] Document arithmetic overflow semantics
Hi Richard,
> I'm more familiar with the Ada standard than that for C99 and C++ and
> there are dozens of places where they describe things that are undefined.
> Are you proposing that we look at each of those, choose (by what criteria?)
> whether we guarantee that a program that has that particular undefined
> behavior is preserved over optimization, and document our choice somewhere?
> And that we do the same for C, C++, Fortran and Java?
>
> If not, precisely *what* are you proposing: I don't understand.
Again, my concern is not with the front-ends. I'm proposing that the
GCC tighten up some of the semantics that it uses from its internal
TREE nodes, so that front-end maintainers can decide whether a GCC
node has semantics compatible with those required by the language.
Ada for example, performs all its own real arithmetic because Ada
specifies constraints on precision that aren't documented for GCC's
tree-nodes. Perhaps, CONST_DOUBLE does what Ada needs, perhaps it
doesn't, but documenting the actual behaviour is a good start.
Similarly, java-tree.def provides its own CONDITIONAL_EXPR because
the semantics it requires may be different from those of C/C++'s
COND_EXPR.
Roger
--