Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/gcc.dg/pragma-align.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/gcc.dg/pragma-align.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,47 @@ +/* Prove that pragma alignment handling works somewhat. */ + +/* { dg-do run { target { ! default_packed } } } */ + +extern void abort (void); + +struct { + char one; + long two; +} defaultalign; + +#if defined(__LP64__) +#pragma pack(8) +#else +#pragma pack(4) +#endif +struct { + char one; + long two; +} sixteen; + +#pragma pack(1) +struct { + char one; + long two; +} two; + +#pragma pack(2) +struct { + char one; + long two; +} three; + +#pragma pack() +struct { + char one; + long two; +} resetalign; + +main() +{ + if(sizeof(sixteen) < sizeof(defaultalign)) abort(); + if(sizeof(two) >= sizeof(defaultalign)) abort(); + if(sizeof(three) <= sizeof(two)) abort(); + if(sizeof(resetalign) != sizeof(defaultalign)) abort(); + return 0; +}