[comp.lang.c] possible VMS C initialization bug

steve@umigw.MIAMI.EDU (steve emmerson) (02/06/89)

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"