[PATCH] Document arithmetic overflow semantics

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Thu Feb 13 15:52:00 GMT 2003


    > Are you really claiming that a program with an uninitialized variable
    > must be compiled in such a way that it produces the same result
    > independent of optimization?

    You got me.  Naturally there are limits.  GCC can't claim that two runs
    of the same executable with an uninitialized variable produce the same
    result.

So then to rephrase the question I asked in my last question, what are those
limits, where do we document them, and how do we decide what they are?

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.



More information about the Gcc mailing list