This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix for 991118-1 failure on big-endian machines
- To: gcc-patches at gcc dot gnu dot org
- Subject: fix for 991118-1 failure on big-endian machines
- From: Geoff Keating <geoffk at ozemail dot com dot au>
- Date: Fri, 19 Nov 1999 14:26:57 +1100
- CC: "Herman A.J. ten Brugge" <Haj dot Ten dot Brugge at net dot HCC dot nl>
This fixes the 991118-1 failure on ppc, taking it back down to 0
c-torture failures.
OK to commit?
--
Geoffrey Keating <geoffk@cygnus.com>
===File ~/patches/cygnus/egcs-llbitfield.patch==============
md5sum: 73ad925b50e68865 4bbde29a57ef9484 447230
Index: egcs/gcc/ChangeLog
0a
Fri Nov 19 12:57:10 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).
.
md5sum: 37422032ea13bf1e 619c410cae643677 124086
Index: egcs/gcc/testsuite/ChangeLog
0a
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.
.
Changed files:
egcs/gcc/ChangeLog
egcs/gcc/testsuite/ChangeLog
egcs/gcc/varasm.c
egcs/gcc/testsuite/gcc.c-torture/execute/991118-1.c
md5sum: 35f36298aa3173c6 10dc74c48901649d 132618
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/varasm.c Fri Nov 19 10:36:01 1999
+++ egcs/gcc/varasm.c Fri Nov 19 13:00:21 1999
@@ -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. */
md5sum: c1c034c8572f64e6 54796db812f2a0d5 683
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/testsuite/gcc.c-torture/execute/991118-1.c Thu Nov 18 18:56:12 1999
+++ egcs/gcc/testsuite/gcc.c-torture/execute/991118-1.c Fri Nov 19 13:26:47 1999
@@ -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 @@ struct 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 @@ struct tmp2 tmp2 = {0x123456789ABCDLL, 0
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);
}
-
============================================================