From: David.Mosberger@NOSPAMacm.org
To: asharma@netscape.com
Subject: Re: gcc Alpha/Intel incompatibility
Date: 1998/03/06 [thread overview]
Message-ID: <ugafb32ofq.fsf@panda.mostang.com> (raw)
In-Reply-To: sn0k9a7xq7z.fsf@zugzwang.mcom.com
Arun Sharma <asharma@netscape.com> writes:
> 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 ?
>
> -Arun
>
> extern int f(char);
>
> typedef struct foo1 {
> int i;
> char c;
> } f1;
>
>
> typedef struct foo2 {
> int (*foo_func)(char);
> int j;
> } f2;
>
> typedef struct foo {
> f1 F1;
> f2 F2;
> } mytype;
>
> mytype foo1 = {
> { 10, 'c'},
> {(int) f, 20}
> };
Remove the cast to "int" and it will compile. On a 64-bit platforms
such as Linux/Alpha, a pointer does not fit into an int, hence the
error message. If the source of your real problem is initialization
of a union, there are several options to fix the problem (reorder the
members in the union, depend on a gcc-specific extension to initialize
unions, or use longs instead of ints).
--david
next prev parent reply other threads:[~1998-03-06 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 ` Arun Sharma
1998-03-06 5:00 ` David.Mosberger [this message]
1998-03-07 5:00 ` Ed Hall
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