summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/20051215-1.c
blob: 0519dc7ce475981563ad87ca5c84f677e58043bd (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
/* ARM's load-and-call patterns used to allow automodified addresses.
   This was wrong, because if the modified register were spilled,
   the call would need an output reload.  */
/* { dg-do run } */
/* { dg-options "-O2 -fno-omit-frame-pointer" } */
extern void abort (void);
typedef void (*callback) (void);

static void
foo (callback *first, callback *p)
{
  while (p > first)
    {
      (*--p) ();
#ifndef __thumb__
      asm ("" : "=r" (p) : "0" (p)
	   : "r4", "r5", "r6", "r7", "r8", "r9", "r10");
#endif
    }   
}

static void
dummy (void)
{
  static int count;
  if (count++ == 1)
    abort ();
}

int
main (void)
{
  callback list[1] = { dummy };
  foo (&list[0], &list[1]);
  return 0;
}