Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!umigw!steve From: steve@umigw.MIAMI.EDU (steve emmerson) Newsgroups: comp.lang.c Subject: possible VMS C initialization bug Summary: can't cast address of structure into pointer Message-ID: <209@umigw.MIAMI.EDU> Date: 6 Feb 89 14:56:58 GMT Reply-To: steve@umigw.miami.edu (steve emmerson) Followup-To: comp.lang.c Distribution: na Organization: University of Miami Lines: 29 I've run into a possible VMS C compiler bug (version 2.4-026). The following code fragment (which is located at the head of a compilation unit) won't compile: typedef struct { int member_1; float member_2; } BIG_S; BIG_S BigStruct = {1, 2.}; typedef struct { int member; } LITTLE_S; int *iptr = &((LITTLE_S*)&BigStruct)->member; Instead, the compiler emits the error message "The initialization of iptr is invalid" at the "*iptr =" line. Conversely, the above fragment does compile (and run) under both my EUNICE C compiler and my VMS GNU C compiler. Question: is the above a bug? -- Steve Emmerson Inet: steve@umigw.miami.edu [128.116.10.1] SPAN: miami::emmerson (host 3074::) emmerson%miami.span@star.stanford.edu UUCP: ...!ncar!umigw!steve emmerson%miami.span@vlsi.jpl.nasa.gov "Computers are like God in the Old Testament: lots of rules and no mercy"