lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #include <stdint.h> |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | #define AL 4096 |
| 5 | struct foo |
| 6 | { |
| 7 | int i; |
| 8 | } __attribute ((aligned (AL))); |
| 9 | |
| 10 | static __thread struct foo f; |
| 11 | static struct foo g; |
| 12 | |
| 13 | |
| 14 | #ifndef FCT |
| 15 | # define FCT in_dso1 |
| 16 | #endif |
| 17 | |
| 18 | |
| 19 | int |
| 20 | FCT (void) |
| 21 | { |
| 22 | puts (__func__); |
| 23 | |
| 24 | int result = 0; |
| 25 | |
| 26 | int fail = (((uintptr_t) &f) & (AL - 1)) != 0; |
| 27 | printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK"); |
| 28 | result |= fail; |
| 29 | |
| 30 | fail = (((uintptr_t) &g) & (AL - 1)) != 0; |
| 31 | printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK"); |
| 32 | result |= fail; |
| 33 | |
| 34 | return result; |
| 35 | } |