Re:Google broke a conditional statement that verifies passwo...
by xmprt on Thursday July 22, 2021 @04:53PM
(#27924186)
So instead of short circuiting like that code should when it uses &&, it instead makes an assumption about the first part of the boolean expression because otherwise the code would have undefined behavior?
[ Parent
| on HN ]
Re:Google broke a conditional statement that verifies passwo...
by dataflow on Thursday July 22, 2021 @04:59PM
(#27924249)
Yeah. More specifically, it just inserts whatever behavior it likes for the undefined scenario, which in this case is "the same behavior as in the defined scenario".
Re:Google broke a conditional statement that verifies passwo...
by ddalex on Friday July 23, 2021 @03:03AM
(#27927996)
I am utterly confused. How would the compiler know that has_value() guarantees that the ->label dereferencing work, since this is a bitwise operation ?
Re:Google broke a conditional statement that verifies passwo...
by dataflow on Friday July 23, 2021 @03:06AM
(#27928022)
I would imagine has_value is checking to see if a pointer is NULL, and -> is dereferencing that same pointer. When the optimizer sees the two together it realizes the former is useless.