Patch for uninitialized structures in tests
Mark Mitchell
mark@codesourcery.com
Mon Apr 28 08:28:00 GMT 2008
John David Anglin wrote:
> As far as I am aware, the hpux malloc implementation conforms to
> the ISO C standard. The values of the bytes of the allocated storage
> are not specified by the standard.
And, at least in theory, on some platforms you can get a program crash
just by reading uninitialized data. The C standard says:
> Certain object representations need not represent a value of the object type. If the stored
> value of an object has such a representation and is read by an lvalue expression that does
> not have character type, the behavior is undefined. If such a representation is produced
> by a side effect that modifies all or any part of the object by an lvalue expression that
> does not have character type, the behavior is undefined.41) Such a representation is called
> a trap representation.
I believe that Itanium has bit-patterns that will cause an error when
accessed.
So, I think these test-cases should be modified to explicitly initialize
the data, whether by use of "calloc", "memset", an explicit loop, etc.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list