This commit was manufactured by cvs2svn to create branch

'gcc-3_2-branch'.

From-SVN: r56103
This commit is contained in:
No Author 2002-08-07 18:11:00 +00:00
parent d5997d02bd
commit 379aa2fe2e
4 changed files with 132 additions and 0 deletions

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;
}

View File

@ -0,0 +1,21 @@
/* This testcase was miscompiled on IA-32, because fold-const
assumed associate_trees is always done on PLUS_EXPR. */
extern void abort (void);
extern void exit (int);
void check (unsigned int m)
{
if (m != (unsigned int) -1)
abort ();
}
unsigned int n = 1;
int main (void)
{
unsigned int m;
m = (1 | (2 - n)) | (-n);
check (m);
exit (0);
}

View File

@ -0,0 +1,17 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-std=c99" } */
/* Source: Neil Booth, 6 Aug 2002.
Tests that we DTRT with varargs commas for a single-parameter macro
when in standards-conforming mode. */
#define f(...) , ## __VA_ARGS__
/* The comma from f's expansion should be retained (standards
conforming mode only). Tests that it isn't in non-standards mode
include macro8.c and vararg1.c. */
#if 2 f() 3 /* { dg-bogus "missing binary operator" } */
#endif

View File

@ -0,0 +1,14 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options -std=gnu99 } */
/* Source: Neil Booth, 6 Aug 2002.
Tests that we DTRT with varargs commas. */
#define g(a, ...) a , ## __VA_ARGS__
/* The comma from g's expansion should be retained. */
#if g (2, ) 3 /* { dg-bogus "missing binary operator" } */
#endif