summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/980526-2.c
blob: c17f4ea6df1bee6dc769bb1a776001cde6488193 (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
typedef unsigned int dev_t;
typedef unsigned int kdev_t;

static inline kdev_t to_kdev_t(int dev)
{
	int major, minor;
	
	if (sizeof(kdev_t) == 16)
		return (kdev_t)dev;
	major = (dev >> 8);
	minor = (dev & 0xff);
	return ((( major ) << 22 ) | (  minor )) ;

}

void do_mknod(const char * filename, int mode, kdev_t dev)
{
	if (dev==0x15800078)
		exit(0);
	else
		abort();
}


char * getname(const char * filename)
{
	register unsigned int a1,a2,a3,a4,a5,a6,a7,a8,a9;
	a1 = (unsigned int)(filename) *5 + 1;
	a2 = (unsigned int)(filename) *6 + 2;
	a3 = (unsigned int)(filename) *7 + 3;
	a4 = (unsigned int)(filename) *8 + 4;
	a5 = (unsigned int)(filename) *9 + 5;
	a6 = (unsigned int)(filename) *10 + 5;
	a7 = (unsigned int)(filename) *11 + 5;
	a8 = (unsigned int)(filename) *12 + 5;
	a9 = (unsigned int)(filename) *13 + 5;
	return (char *)(a1*a2+a3*a4+a5*a6+a7*a8+a9);
}

int sys_mknod(const char * filename, int mode, dev_t dev)
{
	int error;
	char * tmp;

	tmp = getname(filename);
	error = ((long)( tmp )) ;
	do_mknod(tmp,mode,to_kdev_t(dev));
	return error;
}

int main(void)
{
	if (sizeof (int) != 4)
	  exit (0);

	return sys_mknod("test",1,0x12345678);
}