i386.c (x86_field_alignment): Apply min for all MODE_INT and MODE_CLASS_INT modes.

* config/i386/i386.c (x86_field_alignment): Apply min for all MODE_INT
	and MODE_CLASS_INT modes.

	* g++.dg/abi/bitfield3.C: New test.

From-SVN: r56072
This commit is contained in:
Jakub Jelinek 2002-08-06 17:36:40 +02:00 committed by Jakub Jelinek
parent 609a87f3b3
commit 39e3a681df
4 changed files with 93 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2002-08-06 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (x86_field_alignment): Don't check
TARGET_ALIGN_DOUBLE for the second time.
Apply min for all MODE_INT and MODE_CLASS_INT modes.
2002-08-06 Jakub Jelinek <jakub@redhat.com>
* config.gcc (*-*-linux*): Default to --enable-threads=posix if no

View File

@ -13822,7 +13822,9 @@ x86_field_alignment (field, computed)
return computed;
mode = TYPE_MODE (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
? get_inner_array_type (field) : TREE_TYPE (field));
if (mode == DFmode || mode == DCmode || mode == DImode || mode == CDImode)
if (mode == DFmode || mode == DCmode
|| GET_MODE_CLASS (mode) == MODE_INT
|| GET_MODE_CLASS (mode) == MODE_COMPLEX_INT)
return MIN (32, computed);
return computed;
}

View File

@ -1,3 +1,7 @@
2002-08-06 Jakub Jelinek <jakub@redhat.com>
* g++.dg/abi/bitfield3.C: New test.
2002-08-05 Nathan Sidwell <nathan@codesourcery.com>
* lib/gcov.exp: Tweak expected line formats.

View File

@ -0,0 +1,80 @@
// Test for oversized bitfield alignment in structs on IA-32
// { dg-do run { target i?86-*-* } }
// { dg-options "-O2" }
struct A
{
char a;
int b : 224; // { dg-warning "exceeds its type" "" }
char c;
} a, a4[4];
struct B
{
char d;
A e;
char f;
} b;
struct C
{
char g;
long long h : 64;
char i;
} c, c4[4];
struct D
{
char j;
C k;
char l;
} d;
struct E
{
char m;
long long n : 160; // { dg-warning "exceeds its type" "" }
char o;
} e, e4[4];
struct F
{
char p;
E q;
char r;
} f;
int main (void)
{
if (&a.c - &a.a != 32)
return 1;
if (sizeof (a) != 36)
return 2;
if (sizeof (a4) != 4 * 36)
return 3;
if (sizeof (b) != 2 * 4 + 36)
return 4;
if (__alignof__ (b.e) != 4)
return 5;
if (&c.i - &c.g != 16)
return 6;
if (sizeof (c) != 24)
return 7;
if (sizeof (c4) != 4 * 24)
return 8;
if (sizeof (d) != 2 * 8 + 24)
return 9;
if (__alignof__ (d.k) != 8)
return 10;
if (&e.o - &e.m != 28)
return 11;
if (sizeof (e) != 32)
return 12;
if (sizeof (e4) != 4 * 32)
return 13;
if (sizeof (f) != 2 * 8 + 32)
return 14;
if (__alignof__ (f.q) != 8)
return 15;
return 0;
}