diff options
Diffstat (limited to 'test/regression')
-rw-r--r-- | test/regression/Results/aligned | 1 | ||||
-rw-r--r-- | test/regression/aligned.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/test/regression/Results/aligned b/test/regression/Results/aligned index 7a4f7c9f..c42a5c40 100644 --- a/test/regression/Results/aligned +++ b/test/regression/Results/aligned @@ -9,3 +9,4 @@ i: size 16, offset mod 16 = 0 j: size 16, offset mod 16 = 0 T2: size 112, alignment 16 T4: size is that of a pointer, alignment is that of a pointer +t2: size 9, alignment 1 diff --git a/test/regression/aligned.c b/test/regression/aligned.c index 3b5a9374..bd16d513 100644 --- a/test/regression/aligned.c +++ b/test/regression/aligned.c @@ -3,6 +3,7 @@ #include <stdio.h> #define ALIGNED __attribute((aligned(16))) +#define ALIGNED1 __attribute((aligned(1))) typedef ALIGNED char c16; @@ -72,6 +73,10 @@ typedef T2 T3[]; typedef struct { T3 *area; } T4; /* Expected: size of a pointer, alignment of a pointer */ +struct t1 { double d; }; +struct t2 { char c; ALIGNED1 struct t1 d; }; +/* Expected: size = 1 + 8, alignment 1 */ + void check(const char * msg, void * addr, size_t sz) { printf("%s: size %zu, offset mod 16 = %lu\n", @@ -104,5 +109,7 @@ int main() sizeof(T4) == sizeof(void *) ? "is" : "IS NOT", _Alignof(T4) == _Alignof(void *) ? "is" : "IS NOT"); + printf("t2: size %zu, alignment %zu\n", + sizeof(struct t2), _Alignof(struct t2)); return 0; } |