ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

`this == nullptr` results in undefined behavior

Open ShortDevelopment opened this issue 1 year ago • 3 comments

Issue

‘this’ pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true

Tasks

ShortDevelopment avatar Apr 17 '24 13:04 ShortDevelopment

This warning should now be enabled in Clang by default, though didn't catch this earlier due to -Werror, I suspect it wasn't enabled in the version from the package manager.

ppenzin avatar Apr 17 '24 16:04 ppenzin

https://github.com/chakra-core/ChakraCore/blob/2af598f04ab508f9231d6e26f0f82f5a57561413/lib/Backend/IR.cpp#L4852

ShortDevelopment avatar Apr 18 '24 21:04 ShortDevelopment

I had a look IR.cpp and the invalid check is being done part of a Debug only feature; so it's not as critical a concern as ImmutableList.

I've also done a sequence of searches in the codebase and I don't think there's anything else.

rhuanjl avatar Apr 19 '24 19:04 rhuanjl