diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-12-11 06:59:12 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2005-12-10 22:59:12 -0800 |
commit | 4540a3ade18d12fa93b67426b6d722d84902d906 (patch) | |
tree | 9f61241fd1b0a770954dad72e767c7926af8ce56 /gcc | |
parent | 153b4898d243846931a06682cd06ce16b826d755 (diff) | |
download | gcc-4540a3ade18d12fa93b67426b6d722d84902d906.zip gcc-4540a3ade18d12fa93b67426b6d722d84902d906.tar.gz gcc-4540a3ade18d12fa93b67426b6d722d84902d906.tar.bz2 |
re PR libobjc/25347 (objc_alignof_type gets the wrong alignment for unions (objc_sizeof_type is wrong also too))
2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/25347
* encoding.c (objc_sizeof_type): Don't handle _C_UNION_B special
but use the struct layout functions.
(objc_alignof_type): Likewise.
(objc_layout_structure): Handle _C_UNION_B also.
(objc_layout_structure_next_member): Likewise.
(objc_layout_finish_structure): Likewise.
2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/25347
* objc.dg/encode-8.m: New test.
From-SVN: r108379
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/encode-8.m | 31 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71286b1..21ec14b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2005-12-11 Andrew Pinski <pinskia@physics.uc.edu> + PR libobjc/25347 + * objc.dg/encode-8.m: New test. + +2005-12-11 Andrew Pinski <pinskia@physics.uc.edu> + PR libobjc/25346 * objc.dg/encode-7.m: New test. diff --git a/gcc/testsuite/objc.dg/encode-8.m b/gcc/testsuite/objc.dg/encode-8.m new file mode 100644 index 0000000..947a929 --- /dev/null +++ b/gcc/testsuite/objc.dg/encode-8.m @@ -0,0 +1,31 @@ +/* { dg-options "-fgnu-runtime" } */ +/* { dg-do run } */ + +#include <objc/encoding.h> +#include <stdlib.h> + +union f +{ + char i; + double f1; + short t; +}; + +union g +{ + int i; +}; + + +int main(void) +{ + if (objc_sizeof_type (@encode (union f)) != sizeof(union f)) + abort (); + if (objc_alignof_type (@encode (union f)) != __alignof__(union f)) + abort (); + if (objc_sizeof_type (@encode (union g)) != sizeof(union g)) + abort (); + if (objc_alignof_type (@encode (union g)) != __alignof__(union g)) + abort (); + return 0; +} |