This is the mail archive of the gcc-bugs@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]

Re: Wrong optimization in current CVS


On Thursday 16 November 2000 00:52, Franz Sirl wrote:
> Hi,
>
> the attached testcase nicely shows a recently introduced optimization that
> affects linux kernel compilation. I actually noticed it while fixing
> warnings in the kernel.
>
> OK to commit as execute/20001115-1.c?

Argh, forgot to attach!

Franz.
extern void abort (void);
extern void exit (int);

struct iso_directory_record {
           unsigned char name_len [1];
           char name [0];
} entry;

void set(struct iso_directory_record *);

int main (void)
{
   struct iso_directory_record *de;

   de = &entry;
   set(de);

   if (de->name_len[0] == 1 && de->name[0] == 0)
     exit (0);
   else
     abort ();
}

void set (struct iso_directory_record *p)
{
   p->name_len[0] = 1;
   return;
}

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