DescriptionMake FieldType::None() non-nullptr value to avoid undefined behaviour
When FieldType::None() returns a cast Smi::FromInt(0), which translates
as nullptr, the FieldType::IsNone() check becomes equivalent to
`this == nullptr` which is not allowed by the standard and
therefore optimized away as a false constant by GCC 6.
This has lead to crashes when invoking methods on FieldType::None().
Using a different Smi constant for FieldType::None() makes the compiler
always include a comparison against that value. The choice of these
constants has no effect as they are effectively arbitrary.
BUG=https://github.com/nodejs/node/issues/8310
Committed: https://crrev.com/8ed65b97a3307e4d603e567ae29020dd74baf7c0
Cr-Commit-Position: refs/heads/master@{#39023}
Patch Set 1 #Patch Set 2 : Make FieldType::None() non-nullptr value to avoid undefined behaviour #Patch Set 3 : (fix build by removing unused var in test) #
Messages
Total messages: 17 (8 generated)
|