[Openvpn-devel] [PATCH] Don't deference type-punned pointers

2016-11-13 Thread Steffan Karger
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.

Re: [Openvpn-devel] [PATCH] Don't deference type-punned pointers

2016-11-11 Thread David Sommerseth
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.

Re: [Openvpn-devel] [PATCH] Don't deference type-punned pointers

2016-11-11 Thread David Sommerseth
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. > >

Re: [Openvpn-devel] [PATCH] Don't deference type-punned pointers

2016-10-18 Thread David Sommerseth
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

Re: [Openvpn-devel] [PATCH] Don't deference type-punned pointers

2016-10-18 Thread Arne Schwabe
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

[Openvpn-devel] [PATCH] Don't deference type-punned pointers

2016-09-28 Thread 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. See e.g. http://blog.regehr.org/archives/959. Signed-off-by: Steffan Karger ---