GetOrCreateLLVMGlobal() accepts nullptr D, but in some cases we end up dereferencing it without checking if it's non-null.
Fixes PR15492.
Differential D20141
Check for nullptr argument. tra on May 10 2016, 4:14 PM. Authored by
Details GetOrCreateLLVMGlobal() accepts nullptr D, but in some cases we end up dereferencing it without checking if it's non-null. Fixes PR15492.
Diff Detail
Event TimelineComment Actions I've never seen it triggered. Fix is based on the comment above the function that D==nullptr is acceptable and the fact that we are checking D in other places in this function. Two cases where nullptr D is passed explicitly has something to do with -fblocks, but that does not seem to be used neither with CUDA nor with 'IsForDefinition' which was brought in to deal with a strange case of redefining C++ symbols in C. This is probably why it's not triggered. Comment Actions If you have a check that doesn't have a test/is never triggered - simple
Comment Actions OK, if the function explicitly says it accepts null values and if we check elsewhere in the function, I'm personally OK adding the checks. |