| 1 |
/* Verify that alloca storage is sufficiently aligned. */ |
| 2 |
/* ??? May fail if BIGGEST_ALIGNMENT > STACK_BOUNDARY. Which, I guess |
| 3 |
can only happen on !STRICT_ALIGNMENT targets. */ |
| 4 |
|
| 5 |
typedef __SIZE_TYPE__ size_t; |
| 6 |
void abort (void); |
| 7 |
|
| 8 |
struct dummy { int x __attribute__((aligned)); }; |
| 9 |
#define BIGGEST_ALIGNMENT __alignof__(struct dummy) |
| 10 |
|
| 11 |
_Bool foo(void) |
| 12 |
{ |
| 13 |
char *p = __builtin_alloca(32); |
| 14 |
return ((size_t)p & (BIGGEST_ALIGNMENT - 1)) == 0; |
| 15 |
} |
| 16 |
|
| 17 |
int main() |
| 18 |
{ |
| 19 |
if (!foo()) |
| 20 |
abort (); |
| 21 |
return 0; |
| 22 |
} |