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)


On Sunday 15 January 2006 22:13, John David Anglin wrote:
> #include <stdio.h>
> unsigned char
> T (unsigned char x)
> {
>   static int first = 1;
>   static unsigned char firstx;
>
>   if (first)
>     {
>       first = 0;
>       firstx = x;
>       return ~x;
>     }
>
>   if (x == firstx)
>     printf ("Behavior is pre GCC 4.0\n");
>   else
>     printf ("Behavior is GCC 4.0 and later\n");
>   return 0;
> }

So firstx can have an indeterminate value coming into "if (x == firstx)"
and the behavior is still undefined.

For what it's worth, it annoys me to no end that you have managed to
turn more than a day of hard work to understand and fix PR24626 into
a discussion about defining undefined behavior.  I don't think I'll
ever look at HPPA bugs anymore if they don't affect me.

Gr.
Steven


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