From 1c7e1f4e0b9d338c209a8e73a00c8e9ab42b22e3 Mon Sep 17 00:00:00 2001 From: Russ Keldorph Date: Sun, 30 Apr 2017 06:17:30 -0700 Subject: Fix some static analysis warnings Most fixes are just addressing the use of (signed) enum-typed variables as array indices. Casting to unsigned allows us to cheaply include the lower bound checks in the existing upper bound checks. I would prefer to force the underlying types of enumerations to be unsigned, but that is a relatively new C++ feature and could have broader consequences than I want to risk at this point. The one other fix to asmparse.cpp just suppresses a warning that, while technically valid, is not causing a real problem. Perhaps this will get better if/when #2305 is addressed. --- src/vm/methodtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vm/methodtable.h') diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index df60fca09d..1e557c4253 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -663,7 +663,7 @@ SystemVClassificationType CorInfoType2UnixAmd64Classification(CorElementType eeT _ASSERTE((SystemVClassificationType)toSystemVAmd64ClassificationTypeMap[ELEMENT_TYPE_TYPEDBYREF] == SystemVClassificationTypeTypedReference); _ASSERTE((SystemVClassificationType)toSystemVAmd64ClassificationTypeMap[ELEMENT_TYPE_BYREF] == SystemVClassificationTypeIntegerByRef); - return (((int)eeType) < ELEMENT_TYPE_MAX) ? (toSystemVAmd64ClassificationTypeMap[eeType]) : SystemVClassificationTypeUnknown; + return (((unsigned)eeType) < ELEMENT_TYPE_MAX) ? (toSystemVAmd64ClassificationTypeMap[eeType]) : SystemVClassificationTypeUnknown; }; #define SYSTEMV_EIGHT_BYTE_SIZE_IN_BYTES 8 // Size of an eightbyte in bytes. -- cgit v1.2.3