Boost logo

Boost Users :

Subject: [Boost-users] dereferencing type-punned pointer will break strict-aliasing rules
From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2011-05-05 07:35:57


Dear all,

[Boost 1.46, GCC 4.5.1, MinGW32, WinXP SP3]

I use a number of Boost libraries that I see emit the following warning in GCC under release build:

"dereferencing type-punned pointer will break strict-aliasing rules"

I have traced the code (of SmartPtr and Function specifically) and it's always with an operations like

reinterpret_cast<T*>(...)->~T().

Now, I'm wondering how safe this reinterpret_cast is? How serious should I take this warning here? (I do already know how to turn it off or the strict aliasing check.) And, more than anything else: Is this warning suggesting an improvement in my own code?

TIA,
--Hossein


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net