| 1 |
typedef long int ssize_t; |
| 2 |
typedef long unsigned int size_t; |
| 3 |
|
| 4 |
extern int open(const char* __file, int __oflag, ...) __attribute__((__nonnull__(1))); |
| 5 |
extern int close(int __fd); |
| 6 |
extern ssize_t read(int __fd, void* __buf, size_t __nbytes); |
| 7 |
|
| 8 |
struct ring |
| 9 |
{ |
| 10 |
char buf[1024]; |
| 11 |
}; |
| 12 |
|
| 13 |
int |
| 14 |
test(const char* name) |
| 15 |
{ |
| 16 |
struct ring ring; |
| 17 |
int fd; |
| 18 |
int ret; |
| 19 |
|
| 20 |
fd = open(name, 00); |
| 21 |
if (fd < 0) |
| 22 |
return 0; |
| 23 |
|
| 24 |
ret = read(fd, &ring, sizeof(ring)); |
| 25 |
close(fd); |
| 26 |
|
| 27 |
if (ret != sizeof(ring)) |
| 28 |
return 1; |
| 29 |
|
| 30 |
if (ring.buf[0] > 1) /* { dg-bogus "use of uninitialized value" } */ |
| 31 |
return 2; |
| 32 |
return 3; |
| 33 |
} |