From: edhall@ayched.com (Ed Hall)
Subject: Re: gcc Alpha/Intel incompatibility
Date: 1998/03/07 [thread overview]
Message-ID: <EpFpKu.MEF@ayched.com> (raw)
In-Reply-To: sn0k9a7xq7z.fsf@zugzwang.mcom.com
Arun Sharma (asharma@netscape.com) wrote:
: The following program compiles on Intel but fails to compile on
: Alpha. I've tried both gcc-2.7.2.3 and egcs-1.0.1.
: Can someone tell me why ?
It's invalid code. You cast the pointer-to-function initializer
to an "int":
mytype foo1 = {
{ 10, 'c'},
{(int) f, 20}
};
Change this to:
mytype foo1 = {
{ 10, 'c'},
{ f, 20}
};
and it compiles fine.
On an Alpha, it is impossible to represent a function pointer (a
64-bit quantity) with an int (a 32-bit quantity). Thus the
initializer fails, whereas on Intel where sizeof(pointer) ==
sizeof(int) you only get a warning. You DID see the warning,
didn't you?
Admittedly, the error is cryptic, even misleading. In that
sense, it's a bug. But GCC is hardly alone in sometimes
getting confused when faced with invalid programs...
-Ed Hall
edhall@ayched.com
prev parent reply other threads:[~1998-03-07 5:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-03-06 5:00 gcc Alpha/Intel incompatibility Arun Sharma
1998-03-06 5:00 ` David.Mosberger
1998-03-06 5:00 ` Arun Sharma
1998-03-07 5:00 ` Ed Hall [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox