[Bug c++/53762] pointer-casts don't always check null-pointers
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53762 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID --- Comment #3 from Andrew Pinski 2012-06-24 18:09:39 UTC --- Invalid as mentioned as: pa = &static_cast(*pb); ^^^ Deferences a null pointer at the caret.
[Bug c++/53762] pointer-casts don't always check null-pointers
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53762 --- Comment #2 from Jonathan Wakely 2012-06-24 16:30:54 UTC --- These are allowed: pa = static_cast(pb); pb = static_cast(pa); All the other casts are not because they involve dereferencing a null pointer which is not allowed by [expr.unary.op]/1 Also, GCC 4.2 is not supported or maintained so there's no point reporting bugs against it, you should check a newer release before reporting bugs.
[Bug c++/53762] pointer-casts don't always check null-pointers
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53762 Jonathan Wakely changed: What|Removed |Added Severity|major |normal --- Comment #1 from Jonathan Wakely 2012-06-24 16:26:17 UTC --- Your program dereferences null pointers, that's undefined behaviour.