summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/20050603-1.c
blob: 041551ba5ae3607561f2783e341bb47890365931 (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
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-options "-O2" } */
#include <locale.h>
#include <stdlib.h>
register int *testreg asm ("r29");

int x;
int y;
int *ext_func (int *p) { return p; }

void test_reg_save_restore (int*) __attribute__((noinline));
void
test_reg_save_restore (int *p)
{
    setlocale (LC_ALL, "C");
    testreg = ext_func(p);
}
main() {
  testreg = &x;
  test_reg_save_restore (&y);
  if (testreg != &y)
    abort ();
  return 0;
}