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)


Ian Lance Taylor <ian@airs.com> writes:

| Paul Schlie <schlie@comcast.net> writes:
| 
| >   As a simple example, although x may be indeterminate -1 < sin(x) < +1
| >   is unconditionally true, as must be tan(x) = sin(x)/cos(x), and x^x = 0;
| 
| No, the ISO C standard is clear that an uninitialized variable may be
| set to a trap representation (6.7.8, 3.17.2).  So in this case x might
| be a signalling NaN, and executing sin (x) might well terminate the
| program with a floating point exception.  That would be a valid
| translation of the program by the compiler, and would even be
| reasonable and appropriate in a non-optimized compilation.

what if x is declared as

    unsigned char x;

?

-- Gaby


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