Fix #14891 FP knownConditionTrueFalse (dereferencing pointer to array member)#8704
Fix #14891 FP knownConditionTrueFalse (dereferencing pointer to array member)#8704chrchr-github wants to merge 6 commits into
Conversation
|
@pfultz2 Please review, I'm not entirely sure this is the right fix. |
|
Yea this is not the right fix. The correct fix should be in First Secondly, the lifetime of |
|
@pfultz2 I would appreciate one more review on this. |
| continue; | ||
| if (tok->astOperand2()->exprId() == 0) | ||
| continue; | ||
| if (tok->astOperand2()->variable() && tok->astOperand2()->variable()->isArray() && tok->astOperand2()->variable()->getTypeName() != "std::array") // array to pointer decay |
There was a problem hiding this comment.
Should also check its being assigned to a pointer: astIsPointer(tok->astOperand1()).
Also I dont really see the point in checking for std::array, and its probably better to not check just in case a future version of C++ add implicit conversions to support pointer-like decaying behavior.
There was a problem hiding this comment.
Actually even better would be to compare the pointer rank if it matches: tok->astOperand1()->valueType().pointer != tok->astOperand2()->valueType().pointer
No description provided.