http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61125
Bug ID: 61125 Summary: static_cast of null pointer return invalid pointer (not null) Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slorents at gmail dot com Created attachment 32766 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32766&action=edit Bug example The standard indicates that if a null pointer value is being cast that the result will be a null pointer value (5.2.9/8 Static cast). See attachment. gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 64 bit Output: hook = 00007fffffffe504 obj = 00007fffffffe500 right=00007fffffffe500 hook = 0000000000000000 obj = fffffffffffffffc right=0000000000000000 MyObj *obj = static_cast<MyObj*>(hook) Expected 0000000000000000 instead fffffffffffffffc.