public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] gcc bug
@ 2001-01-26  8:09 David Mosberger
  2001-01-26  9:40 ` Keith Owens
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Mosberger @ 2001-01-26  8:09 UTC (permalink / raw)
  To: linux-ia64

The attached program demonstrates a gcc code generation bug.  I'm
seeing this bug with the November snapshot with all patches applied.
Specifically, if I compile the program with "-O", it works fine and I
get:

	$ gcc -O t.c
	$ ./a.out 
	feed0000beef

However, if I compile it with "-O2", I get:

	$ gcc -O2 t.c
	$ ./a.out
	beef

which obviously can't be right.

	--david

struct f {
  unsigned long lo : 32;
  unsigned long hi : 32;
};

unsigned long r;

void
doit (unsigned long value1, unsigned long value2)
{
  unsigned long w, t;

  ((struct f*)&w)->lo = ((struct f*)&value1)->lo;
  ((struct f*)&w)->hi = ((struct f*)&value2)->hi;
  r = w;
}

int
main (int argc, char **argv)
{
  doit(0xbeef, 0xfeed00000000);
  printf ("%lx\n", r);
}


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-01-27  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-26  8:09 [Linux-ia64] gcc bug David Mosberger
2001-01-26  9:40 ` Keith Owens
2001-01-27  4:20 ` Jim Wilson
2001-01-27  5:21 ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox