OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [20020706-1.c] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
// Contributed by Alexandre Oliva <aoliva@redhat.com>
2
// From Red Hat case 106165.
3
 
4
typedef struct s1
5
{
6
  unsigned short v1;
7
  unsigned char *v2;
8
} S1;
9
 
10
extern void bar(const struct s1 *const hdb);
11
extern unsigned char* foo ();
12
 
13
unsigned int sn;
14
S1 *hdb;
15
S1 *pb;
16
unsigned short len;
17
 
18
unsigned int crashIt()
19
{
20
  unsigned char *p;
21
  unsigned int nsn;
22
  unsigned short cnt;
23
 
24
  if (sn != 0) return 1;
25
 
26
  if ((len < 12) || ((p = (((pb->v1) >= 8) ? pb->v2 : foo() )) == 0))
27
    return 1;
28
 
29
  nsn = (
30
         (((*(unsigned int*)p) & 0x000000ff) << 24) |
31
         (((*(unsigned int*)p) & 0x0000ff00) << 8)  |
32
         (((*(unsigned int*)p) & 0x00ff0000) >> 8)  |
33
         (((*(unsigned int*)p) & 0xff000000) >> 24)  );
34
  p += 4;
35
 
36
  cnt = (unsigned short) ((
37
                           (((*(unsigned int*)p) & 0x000000ff) << 24) |
38
                           (((*(unsigned int*)p) & 0x0000ff00) << 8)  |
39
                           (((*(unsigned int*)p) & 0x00ff0000) >> 8)  |
40
                           (((*(unsigned int*)p) & 0xff000000) >> 24)  ) &
41
                          0xffff);
42
 
43
  if ((len != 12 + (cnt * 56)) || (nsn == 0))
44
    {
45
      bar(hdb);
46
      return 1;
47
    }
48
 
49
  return 0;
50
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.