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: Storage for uninitialized objects (PR 24626)


John David Anglin wrote:

This seems pretty clear. C99 requires that storage be allocated

for uninitialized objects, that an indeterminate value be stored
in the object when the declarator for the object is reached in the
block, that the last-stored value be retained for the duration of
the block.


I think that is an incorrect interpretation. Remember the standard is
always "as-if" when it gives an implementation approach. Please
show a correct C program that can tell that gcc is not following
the above scheme.

Now, the argument being advanced here is that this is all irrelevant
since the use of an indeterminate value constitutes undefined behavior
and GCC can pretty much do anything. However, "undefined behavior"
is conditional on the standard not imposing requirements on the construct,
data or object. Further, I think the general intent was that
implementations be as portable as possible.


Obviously the "as possible" is the operable word here, or you would not find
undefined in the standard. Undefined is always about non-portability.

Dave





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