varasm.c (output_constructor): Solve problem with long long bitfields...

* varasm.c (output_constructor): Solve problem with long long
bitfields, even on BYTES_BIG_ENDIAN machines (testcase 991118-1).

From-SVN: r30598
This commit is contained in:
Geoff Keating 1999-11-21 07:53:01 +00:00 committed by Geoffrey Keating
parent 06a964de82
commit 8b1cb95b76
4 changed files with 47 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Sun Nov 21 17:11:13 1999 Geoffrey Keating <geoffk@cygnus.com>
* 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 <hubicka@freesoft.cz>
* i386.md (neg, not and abs patterns): Revmap to use

View File

@ -1,3 +1,8 @@
1999-11-19 Geoffrey Keating <geoffk@cygnus.com>
* 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 <nathan@acm.org>
* g++.old-deja/g++.ext/restrict1.C: New test.

View File

@ -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);
}

View File

@ -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. */