OSDN Git Service

* builtins.def: Defome atan, atanf, atanl, tan, tanf and tanl
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20011119-1.c
1 /* Test for reload failing to eliminate from argp to sp.  */
2 /* { dg-do run { target i?86-*-* } } */
3 /* { dg-options "-O2 -fomit-frame-pointer" } */
4
5 static int ustrsize (const char *s);
6 static int (*ucwidth) (int c);
7 static int (*ugetxc) (const char **s);
8 static int (*usetc) (char *s, int c);
9
10 char *ustrzcat(char *dest, int size, const char *src)
11 {
12    int pos = ustrsize(dest);
13    int c;
14
15    size -= pos + ucwidth(0);
16
17    while ((c = ugetxc(&src)) != 0) {
18       size -= ucwidth(c);
19       if (size < 0)
20          break;
21
22       pos += usetc(dest+pos, c);
23    }
24
25    usetc(dest+pos, 0);
26
27    return dest;
28 }
29
30 static int __attribute__((noinline))
31 ustrsize (const char *s)
32 {
33   return 0;
34 }
35
36 static int
37 ucwidth_ (int c)
38 {
39   return 1;
40 }
41
42 static int
43 ugetxc_ (const char **s)
44 {
45   return '\0';
46 }
47
48 static int
49 usetc_ (char *s, int c)
50 {
51   return 1;
52 }
53
54 int
55 main()
56 {
57   ucwidth = ucwidth_;
58   ugetxc = ugetxc_;
59   usetc = usetc_;
60   
61   /* ??? It is impossible to explicitly modify the hard frame pointer.
62      This will run afoul of code in flow.c that declines to mark regs
63      in eliminate_regs in regs_ever_used.  Apparently, we have to wait
64      for reload to decide that it won't need a frame pointer before a
65      variable can be allocated to %ebp.
66
67      So save, restore, and clobber %ebp by hand.  */
68
69   asm ("pushl %%ebp\n\t"
70        "movl $-1, %%ebp\n\t"
71        "pushl $0\n\t"
72        "pushl $0\n\t"
73        "pushl $0\n\t"
74        "call %P0\n\t"
75        "addl $12, %%esp\n\t"
76        "popl %%ebp"
77        : : "i"(ustrzcat));
78
79   return 0;
80 }