| 1 |
/* PR target/80968 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-skip-if "no register windows" { *-*-* } { "-mflat" } { "" } } */ |
| 4 |
/* { dg-require-effective-target ilp32 } */ |
| 5 |
/* { dg-options "-mcpu=ultrasparc -O" } */ |
| 6 |
|
| 7 |
/* Make sure references to the stack frame do not slip into the delay slot |
| 8 |
of a return instruction. */ |
| 9 |
|
| 10 |
struct crypto_shash { |
| 11 |
unsigned int descsize; |
| 12 |
}; |
| 13 |
struct crypto_shash *tfm; |
| 14 |
|
| 15 |
struct shash_desc { |
| 16 |
struct crypto_shash *tfm; |
| 17 |
unsigned int flags; |
| 18 |
|
| 19 |
void *__ctx[] __attribute__((aligned(8))); |
| 20 |
}; |
| 21 |
|
| 22 |
static inline unsigned int crypto_shash_descsize(struct crypto_shash *tfm) |
| 23 |
{ |
| 24 |
return tfm->descsize; |
| 25 |
} |
| 26 |
|
| 27 |
static inline void *shash_desc_ctx(struct shash_desc *desc) |
| 28 |
{ |
| 29 |
return desc->__ctx; |
| 30 |
} |
| 31 |
|
| 32 |
#define SHASH_DESC_ON_STACK(shash, ctx) \ |
| 33 |
char __##shash##_desc[sizeof(struct shash_desc) + \ |
| 34 |
crypto_shash_descsize(ctx)] __attribute__((aligned(8))); \ |
| 35 |
struct shash_desc *shash = (struct shash_desc *)__##shash##_desc |
| 36 |
|
| 37 |
extern int crypto_shash_update(struct shash_desc *, const void *, unsigned int); |
| 38 |
|
| 39 |
unsigned int bug(unsigned int crc, const void *address, unsigned int length) |
| 40 |
{ |
| 41 |
SHASH_DESC_ON_STACK(shash, tfm); |
| 42 |
unsigned int *ctx = (unsigned int *)shash_desc_ctx(shash); |
| 43 |
int err; |
| 44 |
|
| 45 |
shash->tfm = tfm; |
| 46 |
shash->flags = 0; |
| 47 |
*ctx = crc; |
| 48 |
|
| 49 |
err = crypto_shash_update(shash, address, length); |
| 50 |
|
| 51 |
return *ctx; |
| 52 |
} |
| 53 |
/* { dg-final { scan-assembler "ld\[ \t\]*\\\[%\[a-z0-9\]*\\+\[0-9\]*\\\], %i0\n\[^\n\]*return\[ \t\]*%i7\\+8" } } */ |