diff options
author | Dale Johannesen <dalej@apple.com> | 2005-12-02 03:02:44 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2005-12-02 03:02:44 +0000 |
commit | a402b2494df386c30aec306f11d23fa03063df1e (patch) | |
tree | 63ea79f69db7b8c04f5869e7c0abcd9e66a028e9 | |
parent | 88151c2fe489c9571d3d9cc34ba1883a19a0d904 (diff) |
2005-12-01 Dale Johannesen <dalej@apple.com>apple/gcc-5305
Radar 4350099
* stor-layout.c (place_field): Keep TREE_FIELDS_REVERSED
in the field nodes, not the RECORD node.
* varasm.c (output_constructor): Ditto.
2005-12-01 Dale Johannesen <dalej@apple.com>
Radar 4350099
* gcc.apple/bitreverse-13.c: New.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-local-200502-branch@107866 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog.apple-ppc | 7 | ||||
-rw-r--r-- | gcc/stor-layout.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog.apple-ppc | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.apple/bitreverse-13.c | 233 | ||||
-rw-r--r-- | gcc/varasm.c | 5 |
5 files changed, 248 insertions, 4 deletions
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc index 63714d35635..e1aa1b598d3 100644 --- a/gcc/ChangeLog.apple-ppc +++ b/gcc/ChangeLog.apple-ppc @@ -1,3 +1,10 @@ +2005-12-01 Dale Johannesen <dalej@apple.com> + + Radar 4350099 + * stor-layout.c (place_field): Keep TREE_FIELDS_REVERSED + in the field nodes, not the RECORD node. + * varasm.c (output_constructor): Ditto. + 2005-12-01 Alan Modra <amodra@bigpond.net.au> Radar 4345871 diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 2645312fef5..c4860277f07 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1183,7 +1183,7 @@ place_field (record_layout_info rli, tree field) tree fsize = DECL_SIZE (field); tree tsize = TYPE_SIZE (TREE_TYPE (field)); /* APPLE LOCAL begin bitfield reversal 4228294 */ - TREE_FIELDS_REVERSED (rli->t) = 1; + TREE_FIELDS_REVERSED (field) = 1; /* APPLE LOCAL end bitfield reversal 4228294 */ /* If we've gone into the next word, move "offset" forward and adjust "bitpos" to compensate. */ diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc index 0bcdb9ee818..24461cfdbd9 100644 --- a/gcc/testsuite/ChangeLog.apple-ppc +++ b/gcc/testsuite/ChangeLog.apple-ppc @@ -1,3 +1,8 @@ +2005-12-01 Dale Johannesen <dalej@apple.com> + + Radar 4350099 + * gcc.apple/bitreverse-13.c: New. + 2005-11-30 Dale Johannesen <dalej@apple.com> Radar 4347034 diff --git a/gcc/testsuite/gcc.apple/bitreverse-13.c b/gcc/testsuite/gcc.apple/bitreverse-13.c new file mode 100644 index 00000000000..5d3d153f682 --- /dev/null +++ b/gcc/testsuite/gcc.apple/bitreverse-13.c @@ -0,0 +1,233 @@ +/* APPLE LOCAL file 4350099 */ +/* { dg-do run { target powerpc*-*-darwin* } } */ +extern void abort (); +extern int printf(const char *, ...); +typedef struct _foo1 FOO1; + +struct _foo1 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +FOO1 vDelim1 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f1() { + union { + unsigned int x; + FOO1 y; + } u; + u.y = vDelim1; + if (u.x != 0x80000000U) + abort (); +} +/***********************************************/ +#pragma reverse_bitfields on + +typedef struct _foo2 FOO2; + +struct _foo2 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +FOO2 vDelim2 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f2() { + union { + unsigned int x; + FOO2 y; + } u; + u.y = vDelim2; + if (u.x != 1) + abort(); +} +#pragma reverse_bitfields off +/****************************************************/ +#pragma reverse_bitfields on + +typedef struct _foo3 FOO3; + +#pragma reverse_bitfields off +struct _foo3 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +FOO3 vDelim3 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f3() { + union { + unsigned int x; + FOO3 y; + } u; + u.y = vDelim3; + if (u.x != 0x80000000U) + abort (); +} +#pragma reverse_bitfields off +/****************************************************/ +#pragma reverse_bitfields on + +struct _foo4 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +typedef struct _foo4 FOO4; + +FOO4 vDelim4 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f4() { + union { + unsigned int x; + FOO4 y; + } u; + u.y = vDelim4; + if (u.x != 1) + abort(); +} +#pragma reverse_bitfields off +/****************************************************/ +#pragma reverse_bitfields on + +struct _foo5 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +#pragma reverse_bitfields off +typedef struct _foo5 FOO5; + +FOO5 vDelim5 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f5() { + union { + unsigned int x; + FOO5 y; + } u; + u.y = vDelim5; + if (u.x != 1) + abort(); +} +#pragma reverse_bitfields off +/****************************************************/ +#pragma reverse_bitfields off + +typedef struct _foo6 FOO6; + +#pragma reverse_bitfields on +struct _foo6 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +FOO6 vDelim6 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f6() { + union { + unsigned int x; + FOO6 y; + } u; + u.y = vDelim6; + if (u.x != 1) + abort(); +} +#pragma reverse_bitfields off +/****************************************************/ +#pragma reverse_bitfields off + +struct _foo7 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +typedef struct _foo7 FOO7; + +FOO7 vDelim7 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f7() { + union { + unsigned int x; + FOO7 y; + } u; + u.y = vDelim7; + if (u.x != 0x80000000U) + abort (); +} +#pragma reverse_bitfields off +/****************************************************/ +#pragma reverse_bitfields off + +struct _foo8 +{ + unsigned int fTab:1, + fSpace:1, + fComma:1, + fSemiColon:1, + fCustom:1, + fConsecutive:1, + iTextDelm:2, + chCustom:16; +}; + +#pragma reverse_bitfields on +typedef struct _foo8 FOO8; + +FOO8 vDelim8 = {1, 0, 0, 0, 0, 0, 0, 0}; +void f8() { + union { + unsigned int x; + FOO8 y; + } u; + u.y = vDelim8; + if (u.x != 0x80000000U) + abort (); +} +#pragma reverse_bitfields off +/****************************************************/ +main() { + f1(); f2(); f3(); f4(); f5(); f6(); f7(); f8(); + return 0; +} diff --git a/gcc/varasm.c b/gcc/varasm.c index 03ec38cdaaa..cdaa8e53f5d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3996,7 +3996,7 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size, /* APPLE LOCAL begin bitfield reversal 4228294 */ if (TREE_CODE (type) == RECORD_TYPE) { - if (TREE_FIELDS_REVERSED (type)) + if (TYPE_FIELDS (type) && TREE_FIELDS_REVERSED (TYPE_FIELDS (type))) { /* If bitfields were reversed they will not be in ascending address order here, which confuses the code below. Sort @@ -4013,8 +4013,7 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size, if (TREE_PURPOSE (head)) { HOST_WIDE_INT pos = int_bit_position (TREE_PURPOSE (head)); - /* Find next field that isn't a bitfield, or is after "head" - in memory. */ + /* Find next field that is after "head" in memory. */ last = head; afterlast = TREE_CHAIN (head); while (afterlast && TREE_PURPOSE (afterlast) |