// gcc -fstrict-aliasing -std=c99 -O2
union
{
int i;
short s;
} u;
int * i = &u.i;
short * s = &u.s;
int main()
{
*i = 2;
*s = 100;
printf(" *i = %d\n", *i
); // prints 2 printf("u.i = %d\n", u.
i); // prints 100
return 0;
}
Ly8gZ2NjICAgICAgIC1mc3RyaWN0LWFsaWFzaW5nIC1zdGQ9Yzk5ICAgLU8yCnVuaW9uCnsgICAKICAgIGludCBpOwogICAgc2hvcnQgczsKfSB1OwoKaW50ICAgICAqIGkgPSAmdS5pOwpzaG9ydCAgICogcyA9ICZ1LnM7CgppbnQgbWFpbigpCnsgICAKICAgICppICA9IDI7CiAgICAqcyAgPSAxMDA7CgogICAgcHJpbnRmKCIgKmkgPSAlZFxuIiwgICppKTsgLy8gcHJpbnRzIDIKICAgIHByaW50ZigidS5pID0gJWRcbiIsIHUuaSk7IC8vIHByaW50cyAxMDAKCiAgICByZXR1cm4gMDsKfQ==