| 1 |
/* PR rtl-optimization/44404 |
| 2 |
foo() used to be miscompiled on ARM due to a bug in auto-inc-dec.c, |
| 3 |
which resulted in "strb r1, [r1], #-36". */ |
| 4 |
|
| 5 |
/* { dg-do run } */ |
| 6 |
/* { dg-options "-O2 -fno-unroll-loops" } */ |
| 7 |
|
| 8 |
extern char *strcpy (char *, const char *); |
| 9 |
extern int strcmp (const char*, const char*); |
| 10 |
extern void abort (void); |
| 11 |
|
| 12 |
char buf[128]; |
| 13 |
|
| 14 |
void __attribute__((noinline)) |
| 15 |
bar (int a, const char *p) |
| 16 |
{ |
| 17 |
if (strcmp (p, "0123456789abcdefghijklmnopqrstuvwxyz") != 0) |
| 18 |
abort (); |
| 19 |
} |
| 20 |
|
| 21 |
void __attribute__((noinline)) |
| 22 |
foo (int a) |
| 23 |
{ |
| 24 |
if (a) |
| 25 |
bar (0, buf); |
| 26 |
strcpy (buf, "0123456789abcdefghijklmnopqrstuvwxyz"); |
| 27 |
bar (0, buf); |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
main (void) |
| 32 |
{ |
| 33 |
foo (0); |
| 34 |
return 0; |
| 35 |
} |