OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr41239.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* PR rtl-optimization/41239 */
2
 
3
struct S
4
{
5
  short nargs;
6
  unsigned long arg[2];
7
};
8
 
9
extern void abort (void);
10
extern void exit (int);
11
extern char fn1 (int, const char *, int, const char *, const char *);
12
extern void fn2 (int, ...);
13
extern int fn3 (int);
14
extern int fn4 (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
15
 
16
unsigned long
17
test (struct S *x)
18
{
19
  signed int arg1 = x->arg[0];
20
  long int arg2 = x->arg[1];
21
 
22
  if (arg2 == 0)
23
    (fn1 (20, "foo", 924, __func__, ((void *) 0))
24
     ? (fn2 (fn3 (0x2040082), fn4 ("division by zero")))
25
     : (void) 0);
26
 
27
  return (long int) arg1 / arg2;
28
}
29
 
30
int
31
main (void)
32
{
33
  struct S s = { 2, { 5, 0 } };
34
  test (&s);
35
  abort ();
36
}
37
 
38
__attribute__((noinline)) char
39
fn1 (int x, const char *y, int z, const char *w, const char *v)
40
{
41
  asm volatile ("" : : "r" (w), "r" (v) : "memory");
42
  asm volatile ("" : "+r" (x) : "r" (y), "r" (z) : "memory");
43
  return x;
44
}
45
 
46
__attribute__((noinline)) int
47
fn3 (int x)
48
{
49
  asm volatile ("" : "+r" (x) : : "memory");
50
  return x;
51
}
52
 
53
__attribute__((noinline)) int
54
fn4 (const char *x, ...)
55
{
56
  asm volatile ("" : "+r" (x) : : "memory");
57
  return *x;
58
}
59
 
60
__attribute__((noinline)) void
61
fn2 (int x, ...)
62
{
63
  asm volatile ("" : "+r" (x) : : "memory");
64
  if (x)
65
    /* Could be a longjmp or throw too.  */
66
    exit (0);
67
}

powered by: WebSVN 2.1.0

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