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 = 7fffe504obj = 7fffe500 right=7fffe500
hook = obj = fffc right=
MyObj *obj = static_cast(hook)
Expected instead fffc.