This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA:] Fix g++.law/bit-fields2.C for mmix-knuth-mmixware
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 25 Mar 2002 06:38:23 -0500 (EST)
- Subject: [RFA:] Fix g++.law/bit-fields2.C for mmix-knuth-mmixware
This test fails for the wrong reason on mmix-knuth-mmixware, because
EMPTY_FIELD_BOUNDARY is defined to 64 (size of registers), but
PCC_BITFIELD_TYPE_MATTERS isn't defined. The test says higher up:
unsigned int : 0; /* force word alignment */
But "word alignment" (if word refers to register size) isn't necessarily
unsigned int alignment. Since effect is dependent on
EMPTY_FIELD_BOUNDARY and PCC_BITFIELD_TYPE_MATTERS (when defined), so
maybe the test isn't useful. An alternative to the patch below is to skip
the test for targets where it holds that EMPTY_FIELD_BOUNDARY is defined
larger than intsize, and PCC_BITFIELD_TYPE_MATTERS isn't defined.
Tested on sims for mmix-knuth-mmixware (now works), cris-axis-elf (still
works). Ok to commit?
* g++.old-deja/g++.law/bit-fields2.C: Check against
sizeof (void *), not sizeof (unsigned int).
Index: bit-fields2.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.law/bit-fields2.C,v
retrieving revision 1.3
diff -u -p -r1.3 bit-fields2.C
--- bit-fields2.C 2000/08/22 18:16:12 1.3
+++ bit-fields2.C 2002/03/24 22:37:05
@@ -27,7 +27,7 @@ main(int argc, char **argv)
{
struct foo bar;
- if (offsetof (struct foo, c) > sizeof (unsigned int))
+ if (offsetof (struct foo, c) > sizeof (void *))
{ printf ("FAIL\n"); return 1; }
else
printf ("PASS\n");
brgds, H-P