Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Studio 12.6 C compiler assertion on anonymous struct inside anonymous union

kovalDec 17 2017 — edited Dec 18 2017

Studio 12.6 C compiler asserts on the when trying to assign a field of anonymous struct inside anonymous union:

struct s {

    int i1, i2;

    union {

        void* v;

        struct {

            int i3;

        };

    };

};

void x(struct s* s)

{

    s->i3 = 3;

}

cc -std=c11 -c union.c:

Assertion failed: offset >= 0 && offset < record->size, file ../src/ctypes.c, line 456

cc: Warning: Static error checker encountered an unexpected error.

Interesting part is, after removing field 'i2' from struct s this code compiles fine

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2018
Added on Dec 17 2017
7 comments
302 views