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]

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
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]