| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-vect-cost-model" } */ |
| 3 |
|
| 4 |
typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short); |
| 5 |
|
| 6 |
void crashIt(int id, FUNC_P *func, unsigned char *funcparm) |
| 7 |
{ |
| 8 |
unsigned char buff[5], reverse[4]; |
| 9 |
unsigned char *bp = buff; |
| 10 |
unsigned char *rp = reverse; |
| 11 |
unsigned short int count = 0; |
| 12 |
unsigned short cnt; |
| 13 |
while (id > 0) |
| 14 |
{ |
| 15 |
*rp++ = (unsigned char) (id & 0x7F); |
| 16 |
id >>= 7; |
| 17 |
count++; |
| 18 |
} |
| 19 |
cnt = count + 1; |
| 20 |
while ((count--) > 1) |
| 21 |
{ |
| 22 |
*bp++ = (unsigned char)(*(--rp) | 0x80); |
| 23 |
} |
| 24 |
*bp++ = *(--rp); |
| 25 |
(void)(*func)(funcparm, buff, cnt); |
| 26 |
} |