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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [20020312-2.c] - Blame information for rev 300

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR 5878.
2
 
3
   We ICEd in verify_local_live_at_start because we incorrectly forced
4
   the PIC register live between BAR and BAZ.  We did this because the
5
   definition of PIC_OFFSET_TABLE_REGNUM was incorrectly not INVALID_REGNUM
6
   when !flag_pic for most targets.  */
7
 
8
/* { dg-do run } */
9
/* { dg-options "-O -fno-pic" } */
10
 
11
extern void abort (void);
12
 
13
#if defined(__alpha__)
14
/* PIC register is $29, but is used even without -fpic.  */
15
#elif defined(__arc__)
16
# define PIC_REG  "26"
17
#elif defined(__arm__)
18
# define PIC_REG  "9"
19
#elif defined(AVR)
20
/* No pic register.  */
21
#elif defined(__cris__)
22
# define PIC_REG  "0"
23
#elif defined(__fr30__)
24
/* No pic register.  */
25
#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__)
26
/* No pic register.  */
27
#elif defined(_IBMR2)
28
/* No pic register.  */
29
#elif defined(__i386__)
30
# define PIC_REG  "ebx"
31
#elif defined(__ia64__)
32
/* PIC register is r1, but is used even without -fpic.  */
33
#elif defined(__lm32__)
34
/* No pic register.  */
35
#elif defined(__M32R__)
36
/* No pic register.  */
37
#elif defined(__m68k__)
38
# define PIC_REG  "a5"
39
#elif defined(__mc68hc1x__)
40
/* No pic register.  */
41
#elif defined(__mcore__)
42
/* No pic register.  */
43
#elif defined(__mips__)
44
/* PIC register is $28, but is used even without -fpic.  */
45
#elif defined(__MMIX__)
46
/* No pic register.  */
47
#elif defined(__mn10300__)
48
/* No pic register.  */
49
#elif defined(__moxie__)
50
/* No pic register.  */
51
#elif defined(__hppa__)
52
/* PIC register is %r27 or %r19, but is used even without -fpic.  */
53
#elif defined(__pdp11__)
54
/* No pic register.  */
55
#elif defined(__powerpc__) || defined(__PPC__) || defined(__POWERPC__) || defined (__ppc)
56
# ifdef __MACH__
57
#  define PIC_REG  "31"
58
# else
59
#  define PIC_REG  "30"
60
# endif
61
#elif defined(__s390__)
62
# define PIC_REG  "12"
63
#elif defined(__sparc__)
64
# define PIC_REG  "l7"
65
#elif defined(__v850)
66
/* No pic register.  */
67
#elif defined(__vax__)
68
/* No pic register.  */
69
#elif defined(__xstormy16__)
70
/* No pic register.  */
71
#elif defined(__XTENSA__)
72
/* No pic register.  */
73
#elif defined(__sh__)
74
# define PIC_REG  "r12"
75
#elif defined(__x86_64__)
76
/* No pic register.  */
77
#elif defined(__m32c__)
78
/* No pic register.  */
79
#elif defined(__SPU__)
80
#  define PIC_REG  "126"
81
#elif defined (__frv__)
82
# ifdef __FRV_FDPIC__
83
#  define PIC_REG "gr15"
84
# else
85
#  define PIC_REG "gr17"
86
#endif
87
#else
88
# error "Modify the test for your target."
89
#endif
90
 
91
#if defined PIC_REG && !defined __PIC__ && !defined __pic__
92
register void *reg __asm__(PIC_REG);
93
#else
94
/* We really need a global register variable set to the PIC register
95
   to expose the bug.  Oh well, let the test case not fail.  */
96
static void *reg;
97
#endif
98
 
99
void * __attribute__((noinline))
100
dummy (void *x)
101
{
102
  return x;
103
}
104
 
105
void
106
f (void)
107
{
108
  goto *dummy (&&bar);
109
  for (;;)
110
    {
111
    foo:
112
      reg = (void *) 1;
113
      if (!reg)
114
        goto baz;
115
      reg = &&foo;
116
    }
117
 
118
 bar:
119
 baz:
120
  reg = 0;
121
}
122
 
123
int
124
main()
125
{
126
  void *old_reg = reg;
127
  reg = (void *) 1;
128
 
129
  f ();
130
 
131
  /* Additionally test that the prologue/epilogue properly does *not*
132
     save and restore global registers.  Not possible when the PIC
133
     register is in a register window, of course.  On Darwin, you can't
134
     call library routines from non-PIC code.  */
135
#if !defined (__sparc__) && !defined(__MACH__)
136
  if (reg)
137
    abort ();
138
#endif
139
 
140
  reg = old_reg;
141
  return 0;
142
}

powered by: WebSVN 2.1.0

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