diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-14 01:28:02 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-14 01:28:02 +0000 |
commit | 7d6d47b862a82f402554ecb2914d407182783964 (patch) | |
tree | 6a62944b86654cab906880e69b8ad5487d9dd84f /clang/lib/Sema/SemaChecking.cpp | |
parent | 97f6ea9f346898a2f75e92abf6b1444ff7e5cffa (diff) | |
download | bcm5719-llvm-7d6d47b862a82f402554ecb2914d407182783964.tar.gz bcm5719-llvm-7d6d47b862a82f402554ecb2914d407182783964.zip |
Fix undefined behavior (and wrong code, as far as I can tell) in NEON builtin
tablegen code, found by -fcatch-undefined-behavior. I would appreciate if
someone more familiar with the NEON code could point me in the direction of how
to write a test for this. We appear to have essentially no test coverage
whatsoever for these builtins.
llvm-svn: 161827
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index a58e9049e48..2594648b56f 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -355,7 +355,7 @@ static QualType getNeonEltType(NeonTypeFlags Flags, ASTContext &Context) { bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { llvm::APSInt Result; - unsigned mask = 0; + uint64_t mask = 0; unsigned TV = 0; int PtrArgNum = -1; bool HasConstPtr = false; @@ -373,7 +373,7 @@ bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; TV = Result.getLimitedValue(64); - if ((TV > 63) || (mask & (1 << TV)) == 0) + if ((TV > 63) || (mask & (1ULL << TV)) == 0) return Diag(TheCall->getLocStart(), diag::err_invalid_neon_type_code) << TheCall->getArg(ImmArg)->getSourceRange(); } |