From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,835480b03da3980a X-Google-Attributes: gid11318c,public X-Google-Thread: f5392,835480b03da3980a X-Google-Attributes: gidf5392,public X-Google-Thread: 111c93,835480b03da3980a X-Google-Attributes: gid111c93,public From: David.Mosberger@NOSPAMacm.org Subject: Re: gcc Alpha/Intel incompatibility Date: 1998/03/06 Message-ID: #1/1 X-Deja-AN: 331600647 References: To: asharma@netscape.com Organization: Home Newsgroups: gnu.gcc.help,comp.os.linux.development.system,comp.os.linux.alpha Arun Sharma 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