This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Disable the bitfield += optimization until it is fixed properly


Hi!

While this bug didn't show up during bootstrap/make check, it shows up while
building e.g. GNOME.
I was completely wrong to use to_rtx's mode, which can very well be BLKmode
or whatever mode the structure with the bitfield has.
On the other side, when to_rtx is a MEM, there is no reason why bitpos +
bitsize can't be bigger than BITS_PER_WORD, it just shouldn't cross the
desired mode's boundary.
Can I commit this quick patch now so that others don't run into this bug,
or should I completely back up all expand_assignment changes and submit
a full new patch when I get it working properly?
One of the attached new testcases gets ICE with current CVS.

2004-07-05  Jakub Jelinek  <jakub@redhat.com>

	* expr.c (expand_assignment): Disable the bitfield += optimizations.

	* gcc.c-torture/execute/20040629-1.c (FIELDS1, FIELDS2): Define to
	nothing if not yet defined.  Use it in b, c and d type definitions.
	* gcc.c-torture/execute/20040705-1.c: New test.
	* gcc.c-torture/execute/20040705-2.c: New test.

--- gcc/expr.c.jj	2004-07-03 18:43:54.000000000 +0200
+++ gcc/expr.c	2004-07-05 21:52:25.443377711 +0200
@@ -3854,7 +3854,7 @@ expand_assignment (tree to, tree from, i
 	  MEM_KEEP_ALIAS_SET_P (to_rtx) = 1;
 	}
 
-      while (mode1 == VOIDmode && !want_value
+      while (0 && mode1 == VOIDmode && !want_value
 	     && bitpos + bitsize <= BITS_PER_WORD
 	     && bitsize < BITS_PER_WORD
 	     && GET_MODE_BITSIZE (GET_MODE (to_rtx)) <= BITS_PER_WORD
--- gcc/testsuite/gcc.c-torture/execute/20040705-1.c.jj	2004-07-05 21:50:46.505754736 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20040705-1.c	2004-07-05 21:50:40.931733733 +0200
@@ -0,0 +1,2 @@
+#define FIELDS1 long long l;
+#include "20040629-1.c"
--- gcc/testsuite/gcc.c-torture/execute/20040705-2.c.jj	2004-07-05 21:50:56.964917735 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20040705-2.c	2004-07-05 21:51:03.660741710 +0200
@@ -0,0 +1,2 @@
+#define FIELDS2 long long l;
+#include "20040629-1.c"
--- gcc/testsuite/gcc.c-torture/execute/20040629-1.c.jj	2004-06-30 12:08:54.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20040629-1.c	2004-07-05 21:50:05.343984194 +0200
@@ -4,9 +4,16 @@
 extern void abort (void);
 extern void exit (int);
 
-struct { unsigned int i : 6, j : 11, k : 15; } b;
-struct { unsigned int i : 5, j : 1, k : 26; } c;
-struct { unsigned int i : 16, j : 8, k : 8; } d;
+#ifndef FIELDS1
+#define FIELDS1
+#endif
+#ifndef FIELDS2
+#define FIELDS2
+#endif
+
+struct { FIELDS1 unsigned int i : 6, j : 11, k : 15; FIELDS2 } b;
+struct { FIELDS1 unsigned int i : 5, j : 1, k : 26; FIELDS2 } c;
+struct { FIELDS1 unsigned int i : 16, j : 8, k : 8; FIELDS2 } d;
 
 unsigned int ret1 (void) { return b.i; }
 unsigned int ret2 (void) { return b.j; }

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]