From: Ilya Date: Thu, 23 Mar 2017 13:58:18 +0000 (+0300) Subject: I used PVS-Studio static analyzer to check this project. I would like to suggest... X-Git-Tag: submit/tizen/20210909.063632~11030^2~7591 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5605aa061520d4ca1caa1dcfca357e333cb5899e;p=platform%2Fupstream%2Fdotnet%2Fruntime.git I used PVS-Studio static analyzer to check this project. I would like to suggest a variant of the way to fix the error, detected with the help of V534 diagnostic. Description of the diagnostic: https://viva64.com/en/examples/v534/ (dotnet/coreclr#10414) Incorrect variable 'i' from the outer loop is used in condition of the inner loop. Commit migrated from https://github.com/dotnet/coreclr/commit/5bcd08108f522524741805d97989e5f227a6bd6b --- diff --git a/src/coreclr/src/tools/metainfo/mdinfo.cpp b/src/coreclr/src/tools/metainfo/mdinfo.cpp index 1432201..753321f 100644 --- a/src/coreclr/src/tools/metainfo/mdinfo.cpp +++ b/src/coreclr/src/tools/metainfo/mdinfo.cpp @@ -1418,7 +1418,7 @@ void MDInfo::DisplayFields(mdTypeDef inTypeDef, COR_FIELD_OFFSET *rFieldOffset, if (cFieldOffset) { bool found = false; - for (ULONG iLayout = 0; i < cFieldOffset; ++iLayout) + for (ULONG iLayout = 0; iLayout < cFieldOffset; ++iLayout) { if (RidFromToken(rFieldOffset[iLayout].ridOfField) == RidFromToken(fields[i])) {