aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/980506-1.c
blob: 9bc2d8afc3e7f12ff23b4abb77a4dcab18d9dda4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* The arrays are too large for the xstormy16 - won't fit in 16 bits. */
/* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */
/* { dg-do assemble { xfail xstormy16-*-* m6811-*-* m6812-*-* } } */

unsigned char	TIFFFax2DMode[20][256];
unsigned char	TIFFFax2DNextState[20][256];
unsigned char	TIFFFaxUncompAction[20][256];
unsigned char	TIFFFaxUncompNextState[20][256];
unsigned char	TIFFFax1DAction[230][256];
unsigned char	TIFFFax1DNextState[230][256];

typedef struct tableentry {
    unsigned short length;
    unsigned short code;
    short       runlen;
} tableentry;

extern tableentry TIFFFaxWhiteCodes[];
extern tableentry TIFFFaxBlackCodes[];

static short sp_data, sp_bit;

static unsigned char
fetchByte (inbuf)

unsigned char **inbuf;

{
    unsigned char byte = **inbuf;
    (*inbuf)++;
    return (byte);
}

static int
decode_white_run (inbuf)

unsigned char **inbuf;

{
    short state = sp_bit;
    short action;
    int runlen = 0;

    for (;;)
    {
	if (sp_bit == 0)
	{
	nextbyte:
	    sp_data = fetchByte (inbuf);
	}

	action = TIFFFax1DAction[state][sp_data];
	state = TIFFFax1DNextState[state][sp_data];
	if (action == 0 )
	    goto nextbyte;
	if (action == 1 )
	    return (-1 );
	if (action == 210 )
	    return (-3 );
	sp_bit = state;
	action = (TIFFFaxWhiteCodes[ action - 2  ].runlen) ;
	runlen += action;
	if (action < 64)
	    return (runlen);
    }
}