[llvm] r314793 - [ARM, Asm] Fix ubsan failure caused by out-of-range enum value
Oliver Stannard via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 3 05:45:19 PDT 2017
Author: olista01
Date: Tue Oct 3 05:45:18 2017
New Revision: 314793
URL: http://llvm.org/viewvc/llvm-project?rev=314793&view=rev
Log:
[ARM, Asm] Fix ubsan failure caused by out-of-range enum value
In this code, we use ~0U as a sentinel value for any operand class that doesn't
have a user-friendly error message, but this value isn't in range of the
MatchClassKind enum, so we need to ensure it does not get passed to isSubclass.
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=314793&r1=314792&r2=314793&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Tue Oct 3 05:45:18 2017
@@ -10211,8 +10211,8 @@ ARMAsmParser::FilterNearMisses(SmallVect
if (std::any_of(PrevReports.first, PrevReports.second,
[DupCheckMatchClass](
const std::pair<unsigned, unsigned> Pair) {
- if (DupCheckMatchClass == ~0U)
- return Pair.second == ~0U;
+ if (DupCheckMatchClass == ~0U || Pair.second == ~0U)
+ return Pair.second == DupCheckMatchClass;
else
return isSubclass((MatchClassKind)DupCheckMatchClass,
(MatchClassKind)Pair.second);
More information about the llvm-commits
mailing list