From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] gcc bug
Date: Fri, 26 Jan 2001 08:09:55 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590693005105@msgid-missing> (raw)
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);
}
next reply other threads:[~2001-01-26 8:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-26 8:09 David Mosberger [this message]
2001-01-26 9:40 ` [Linux-ia64] gcc bug Keith Owens
2001-01-27 4:20 ` Jim Wilson
2001-01-27 5:21 ` David Mosberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-ia64-105590693005105@msgid-missing \
--to=davidm@hpl.hp.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox