Null pointer check elimination

Michael N. Moran mike@mnmoran.org
Mon Nov 14 21:27:00 GMT 2005


Gabriel Dos Reis wrote:
> "Michael N. Moran" <mike@mnmoran.org> writes:
> | Wow. I'm sure there is sound reasoning for this ... but I can't
> | understand what that might be given a client module could intentionally
> | (if ill-adviseadly) simply invoke the function:
>> then it gets what it deserves. Check out GCC manual for null-pointer
> check.

 From info gcc:
`-fdelete-null-pointer-checks'
 Use global dataflow analysis to identify and eliminate useless
 checks for null pointers. The compiler assumes that dereferencing
 a null pointer would have halted the program. If a pointer is
 checked after it has already been dereferenced, it cannot be null.
The second sentence makes me question the difference between an
actual dereferencing operation and the use of a dereferencing
operator used to convert a pointer to a C++ reference. Clearly
(to me anyway ;-) the conversion case does not actually cause
an access to the object.
-- 
Michael N. Moran (h) 770 516 7918
5009 Old Field Ct. (c) 678 521 5460
Kennesaw, GA, USA 30144 http://mnmoran.org
"So often times it happens, that we live our lives in chains
 and we never even know we have the key."
The Eagles, "Already Gone"
The Beatles were wrong: 1 & 1 & 1 is 1


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /