Dereferencing type-punned pointers is undefined behaviour according to the
C standard. We should either obey the standard, or ensure that all
supported compilers deal with dereferencing type-punned pointers as we
want them to. I think just obeying the standard is the easiest solution.
See e.g.
On 11/11/16 13:14, David Sommerseth wrote:
> On 28/09/16 13:08, Steffan Karger wrote:
>> Fixes compiler warnings (undefined behavior) by making the copy
>> explicit to comply to strict aliasing rules. With newer GCC the
>> old code could actually lead to undefined behaviour.
>>
>> See e.g.
On 28/09/16 13:08, Steffan Karger wrote:
> Fixes compiler warnings (undefined behavior) by making the copy explicit
> to comply to strict aliasing rules. With newer GCC the old code could
> actually lead to undefined behaviour.
>
> See e.g. http://blog.regehr.org/archives/959.
>
>
On 28/09/16 13:08, Steffan Karger wrote:
> Fixes compiler warnings (undefined behavior) by making the copy explicit
> to comply to strict aliasing rules. With newer GCC the old code could
> actually lead to undefined behaviour.
>
> See e.g. http://blog.regehr.org/archives/959.
Hmm ... This is
Am 28.09.16 um 13:08 schrieb Steffan Karger:
> Fixes compiler warnings (undefined behavior) by making the copy explicit
> to comply to strict aliasing rules. With newer GCC the old code could
> actually lead to undefined behaviour.
>
I always considered this to be legal C. But if the spec says
Fixes compiler warnings (undefined behavior) by making the copy explicit
to comply to strict aliasing rules. With newer GCC the old code could
actually lead to undefined behaviour.
See e.g. http://blog.regehr.org/archives/959.
Signed-off-by: Steffan Karger
---