20001115-1.c: Don't write to nonexistant memory.

* gcc.c-torture/execute/20001115-1.c: Don't write to nonexistant
        memory.

From-SVN: r37544
This commit is contained in:
Franz Sirl 2000-11-18 18:46:15 +00:00 committed by Richard Henderson
parent 311d8afa84
commit 3734169e0c
2 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2000-11-18 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* gcc.c-torture/execute/20001115-1.c: Don't access nonexistant
memory.
2000-11-17 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.pt/instantiate8.C: New test.

View File

@ -1,28 +1,32 @@
extern void abort (void);
extern void exit (int);
struct iso_directory_record {
union iso_directory_record {
char carr[4];
struct {
unsigned char name_len [1];
char name [0];
} u;
} entry;
void set(struct iso_directory_record *);
void set(union iso_directory_record *);
int main (void)
{
struct iso_directory_record *de;
union iso_directory_record *de;
de = &entry;
set(de);
if (de->name_len[0] == 1 && de->name[0] == 0)
if (de->u.name_len[0] == 1 && de->u.name[0] == 0)
exit (0);
else
abort ();
}
void set (struct iso_directory_record *p)
void set (union iso_directory_record *p)
{
p->name_len[0] = 1;
p->carr[0] = 1;
p->carr[1] = 0;
return;
}