forked from OSchip/llvm-project
[RDA] Avoid negative shift UB
Avoid "left shift of negative value -1" ubsan errors by casting to uintptr_t before performing the shift, rather than after.
This commit is contained in:
parent
1d3b7370c4
commit
8f66f25f52
|
@ -44,7 +44,7 @@ class ReachingDef {
|
|||
|
||||
public:
|
||||
ReachingDef(std::nullptr_t) : Encoded(0) {}
|
||||
ReachingDef(int Instr) : Encoded((Instr << 2) | 2) {}
|
||||
ReachingDef(int Instr) : Encoded(((uintptr_t) Instr << 2) | 2) {}
|
||||
operator int() const { return ((int) Encoded) >> 2; }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue