From: geoffk Date: Sun, 21 Nov 1999 07:53:01 +0000 (+0000) Subject: * varasm.c (output_constructor): Solve problem with long long X-Git-Tag: upstream/4.9.2~104497 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98054e62eff00ba85ea36960ffbee612db4b5240;p=platform%2Fupstream%2Flinaro-gcc.git * varasm.c (output_constructor): Solve problem with long long bitfields, even on BYTES_BIG_ENDIAN machines (testcase 991118-1). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30598 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65809bb..0913a62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sun Nov 21 17:11:13 1999 Geoffrey Keating + + * varasm.c (output_constructor): Solve problem with long long + bitfields, even on BYTES_BIG_ENDIAN machines (testcase 991118-1). + Fri Nov 19 06:32:19 CET 1999 Jan Hubicka * i386.md (neg, not and abs patterns): Revmap to use diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fcad295..013bdd6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +1999-11-19 Geoffrey Keating + + * gcc.c-torture/execute/991118-1.c: Also test case + where the word boundary does not split a byte evenly. + 1999-11-19 Nathan Sidwell * g++.old-deja/g++.ext/restrict1.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/991118-1.c b/gcc/testsuite/gcc.c-torture/execute/991118-1.c index ea769af..77ba888 100644 --- a/gcc/testsuite/gcc.c-torture/execute/991118-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/991118-1.c @@ -10,6 +10,18 @@ struct tmp2 long long int pad : 12; }; +struct tmp3 +{ + long long int pad : 11; + long long int field : 53; +}; + +struct tmp4 +{ + long long int field : 53; + long long int pad : 11; +}; + struct tmp sub (struct tmp tmp) { @@ -24,8 +36,24 @@ sub2 (struct tmp2 tmp2) return tmp2; } +struct tmp3 +sub3 (struct tmp3 tmp3) +{ + tmp3.field ^= 0x0018765412345678LL; + return tmp3; +} + +struct tmp4 +sub4 (struct tmp4 tmp4) +{ + tmp4.field ^= 0x0018765412345678LL; + return tmp4; +} + struct tmp tmp = {0x123, 0x123456789ABCDLL}; struct tmp2 tmp2 = {0x123456789ABCDLL, 0x123}; +struct tmp3 tmp3 = {0x123, 0x1FFFF00000000LL}; +struct tmp4 tmp4 = {0x1FFFF00000000LL, 0x123}; main() { @@ -40,6 +68,12 @@ main() abort (); if (tmp2.pad != 0x123 || tmp2.field != 0xFFF9551175BDFDB5LL) abort (); + + tmp3 = sub3 (tmp3); + tmp4 = sub4 (tmp4); + if (tmp3.pad != 0x123 || tmp3.field != 0xFFF989AB12345678LL) + abort (); + if (tmp4.pad != 0x123 || tmp4.field != 0xFFF989AB12345678LL) + abort (); exit (0); } - diff --git a/gcc/varasm.c b/gcc/varasm.c index e3b0996..d4da698 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4536,7 +4536,8 @@ output_constructor (exp, size) if (shift < HOST_BITS_PER_WIDE_INT && shift + this_time > HOST_BITS_PER_WIDE_INT) { - this_time = (HOST_BITS_PER_WIDE_INT - shift); + this_time = shift + this_time - HOST_BITS_PER_WIDE_INT; + shift = HOST_BITS_PER_WIDE_INT; } /* Now get the bits from the appropriate constant word. */