[llvm] r230684 - Use wider type for overflow check on LLP64 platforms like Win64, found by clang-cl -Wtautological
Reid Kleckner
reid at kleckner.net
Thu Feb 26 13:07:31 PST 2015
Author: rnk
Date: Thu Feb 26 15:07:30 2015
New Revision: 230684
URL: http://llvm.org/viewvc/llvm-project?rev=230684&view=rev
Log:
Use wider type for overflow check on LLP64 platforms like Win64, found by clang-cl -Wtautological
Modified:
llvm/trunk/lib/Support/regcomp.c
Modified: llvm/trunk/lib/Support/regcomp.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/regcomp.c?rev=230684&r1=230683&r2=230684&view=diff
==============================================================================
--- llvm/trunk/lib/Support/regcomp.c (original)
+++ llvm/trunk/lib/Support/regcomp.c Thu Feb 26 15:07:30 2015
@@ -1422,7 +1422,7 @@ enlarge(struct parse *p, sopno size)
if (p->ssize >= size)
return;
- if ((unsigned long)size > SIZE_MAX / sizeof(sop)) {
+ if ((uintptr_t)size > SIZE_MAX / sizeof(sop)) {
SETERROR(REG_ESPACE);
return;
}
@@ -1443,7 +1443,7 @@ static void
stripsnug(struct parse *p, struct re_guts *g)
{
g->nstates = p->slen;
- if ((unsigned long)p->slen > SIZE_MAX / sizeof(sop)) {
+ if ((uintptr_t)p->slen > SIZE_MAX / sizeof(sop)) {
g->strip = p->strip;
SETERROR(REG_ESPACE);
return;
More information about the llvm-commits
mailing list