This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
testcase for word endianness
- To: gcc-patches at gcc dot gnu dot org
- Subject: testcase for word endianness
- From: Geoffrey Keating <geoffk at thief dot cygnus dot com>
- Date: Thu, 28 Dec 2000 15:50:14 -0800
This testcase checks for a bug found in the sh-linux port.
--
Geoff Keating <geoffk@redhat.com>
===File gcc/testsuite/gcc.c-torture/execute/20001228-1.c===
int foo1(void)
{
union {
char a[sizeof (unsigned)];
unsigned b;
} u;
u.b = 0x01;
return u.a[0];
}
int foo2(void)
{
volatile union {
char a[sizeof (unsigned)];
unsigned b;
} u;
u.b = 0x01;
return u.a[0];
}
int main(void)
{
if (foo1() != foo2())
abort ();
exit (0);
}
============================================================