Commit 92b3fc3a by Andreas Schwab Committed by Jeff Law

990326-1.c: Force bitfields to be aligned.

        * execute/990326-1.c: Force bitfields to be aligned.
        (e4, f4): New tests.
        (main): Call them.

From-SVN: r26961
parent 924e00ff
1999-05-17 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* execute/990326-1.c: Force bitfields to be aligned.
(e4, f4): New tests.
(main): Call them.
1999-05-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 1999-05-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/noreturn-1.c: New test. * gcc.dg/noreturn-1.c: New test.
......
...@@ -58,7 +58,7 @@ b3() ...@@ -58,7 +58,7 @@ b3()
struct c { struct c {
unsigned int c:4, b:14, a:14; unsigned int c:4, b:14, a:14;
}; } __attribute__ ((aligned));
int int
c1() c1()
...@@ -86,7 +86,7 @@ c3() ...@@ -86,7 +86,7 @@ c3()
struct d { struct d {
unsigned int a:14, b:14, c:4; unsigned int a:14, b:14, c:4;
}; } __attribute__ ((aligned));
int int
d1() d1()
...@@ -114,7 +114,7 @@ d3() ...@@ -114,7 +114,7 @@ d3()
struct e { struct e {
int c:4, b:14, a:14; int c:4, b:14, a:14;
}; } __attribute__ ((aligned));
int int
e1() e1()
...@@ -140,9 +140,17 @@ e3() ...@@ -140,9 +140,17 @@ e3()
return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
} }
int
e4()
{
static struct e x = { -1, -1, 0 };
return x.a == 0 && x.b & 0x2000;
}
struct f { struct f {
int a:14, b:14, c:4; int a:14, b:14, c:4;
}; } __attribute__ ((aligned));
int int
f1() f1()
...@@ -168,12 +176,20 @@ f3() ...@@ -168,12 +176,20 @@ f3()
return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16));
} }
int
f4()
{
static struct f x = { 0, -1, -1 };
return x.a == 0 && x.b & 0x2000;
}
struct gx { struct gx {
int c:4, b:14, a:14; int c:4, b:14, a:14;
}; } __attribute__ ((aligned));
struct gy { struct gy {
int b:14, a:14, c:4; int b:14, a:14, c:4;
}; } __attribute__ ((aligned));
int int
g1() g1()
...@@ -244,10 +260,10 @@ g7() ...@@ -244,10 +260,10 @@ g7()
struct hx { struct hx {
int a:14, b:14, c:4; int a:14, b:14, c:4;
}; } __attribute__ ((aligned));
struct hy { struct hy {
int c:4, a:14, b:14; int c:4, a:14, b:14;
}; } __attribute__ ((aligned));
int int
h1() h1()
...@@ -316,11 +332,6 @@ h7() ...@@ -316,11 +332,6 @@ h7()
(x.b & 0x3ff0) == (y.b & 0x03ff)); (x.b & 0x3ff0) == (y.b & 0x03ff));
} }
struct foo {
int junk; /* this is to force alignment */
unsigned char w, x, y, z;
};
int int
main() main()
{ {
...@@ -354,12 +365,16 @@ main() ...@@ -354,12 +365,16 @@ main()
abort (); abort ();
if (!e3 ()) if (!e3 ())
abort (); abort ();
if (!e4 ())
abort ();
if (!f1 ()) if (!f1 ())
abort (); abort ();
if (!f2 ()) if (!f2 ())
abort (); abort ();
if (!f3 ()) if (!f3 ())
abort (); abort ();
if (!f4 ())
abort ();
if (!g1 ()) if (!g1 ())
abort (); abort ();
if (!g2 ()) if (!g2 ())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment