chakra-core / ChakraCore

ChakraCore is an open source Javascript engine with a C API.
MIT License
9.06k stars 1.19k forks source link

`this == nullptr` results in undefined behavior #6978

Open ShortDevelopment opened 2 months ago

ShortDevelopment commented 2 months ago

Issue

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

Tasks

ppenzin commented 2 months ago

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.

ShortDevelopment commented 2 months ago

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

rhuanjl commented 2 months ago

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.