Rebase.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr55684.c
blob7002a3737f8722deb99dc9203dc94df04a5563ed
1 /* { dg-do compile } */
3 typedef struct _IO_FILE FILE;
4 unsigned long int strtoul(const char *, char **, int);
5 char *fgets(char *, int, FILE *);
6 struct ihexrec {
7 unsigned char reclen;
8 unsigned char data[256];
9 };
10 static void srec_readrec(struct ihexrec * srec, char * rec)
12 int i, j;
13 char buf[8];
14 int offset = 0, len;
15 char * e;
16 for (i=0; j<srec->reclen; j++)
18 if (offset+2 > len)
19 return;
20 for (i=0; i<2; i++)
21 buf[i] = rec[offset++];
22 srec->data[j] = strtoul(buf, &e, 16);
24 for (i=0; i<2; i++)
25 buf[i] = rec[offset++];
27 void srec2b(FILE *inf)
29 char buffer[256];
30 struct ihexrec srec;
31 while (fgets(buffer,256,inf)!=(void *)0)
32 srec_readrec(&srec, buffer);