OSDN Git Service

* varasm.c (output_constructor): Solve problem with long long
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 21 Nov 1999 07:53:01 +0000 (07:53 +0000)
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 21 Nov 1999 07:53:01 +0000 (07:53 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/991118-1.c
gcc/varasm.c

index 65809bb..0913a62 100644 (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
index fcad295..013bdd6 100644 (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.
index ea769af..77ba888 100644 (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);
 }
-
index e3b0996..d4da698 100644 (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.  */