https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100804

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> - In my example the new warning fires on a struct only having chars. I don't
> see how that is applicable here or how a char array could have a different
> storage order in either big or little endian.  

The scalar storage order is a binary property of structures and unions, i.e.
it's either little- or big-endian and there is no third state.

> - Regardless of that fact. That field is also never accessed in my example
> code 
> Al 2 fields of the structs actually read are consistently be (in)
> and the one written is (out) le.  The ones compare are of the same type. 

What the restriction says is that every single scalar in memory must *always*
be accessible with the same storage order in the entire program; if there are
two possible accesses with different storage order, even if not executed, then
the behavior is undefined.  That's clearly the case for:

union _be_data {
    int   val;
    t_str str;
} BE;

since t_str has little-endian scalar storage order.

Reply via email to