aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>1999-11-21 07:53:01 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>1999-11-21 07:53:01 +0000
commit8b1cb95b7685c0a75ba692bb3f1fe12165c59814 (patch)
tree5e3c9ebabdccf3fde841ec196f1b3a658e239c6b /gcc
parent06a964de822dfc498ee497e253e6ca360a318d8d (diff)
downloadgcc-8b1cb95b7685c0a75ba692bb3f1fe12165c59814.zip
gcc-8b1cb95b7685c0a75ba692bb3f1fe12165c59814.tar.gz
gcc-8b1cb95b7685c0a75ba692bb3f1fe12165c59814.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/991118-1.c36
-rw-r--r--gcc/varasm.c3
4 files changed, 47 insertions, 2 deletions
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 <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
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 <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.
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. */