{"id":397568,"date":"2024-06-29T13:31:54","date_gmt":"2024-06-29T13:31:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=397568"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=397568","title":{"rendered":"<span>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c PVS-Studio \u0432 \u043a\u043e\u0434\u0435 LLVM 15.0<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/tv\/np\/ae\/tvnpaer1umvhcbelxvnzaccw_oq.png\" alt=\"PVS-Studio: \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043e\u0433\u0443\" data-src=\"https:\/\/habrastorage.org\/webt\/tv\/np\/ae\/tvnpaer1umvhcbelxvnzaccw_oq.png\"\/><br \/>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0432\u044b\u0434\u0430\u044e\u0442 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439. \u041e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043b\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a PVS-Studio? \u0414\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a PVS-Studio \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0431\u0430\u0433\u0438 \u0434\u0430\u0436\u0435 \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"naznachenie-stati\">\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438<\/h2>\n<p>  <\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u0430 \u0435\u0441\u0442\u044c \u043b\u0438 \u0441\u043c\u044b\u0441\u043b \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430, \u043f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b\/\u0441\u0440\u0435\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0415\u0441\u0442\u044c \u043b\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0443 \u0442\u0430\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0435\u0440\u0435\u0434 &#171;\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c -Wall&#187;? \u0421\u0442\u043e\u0438\u0442 \u043b\u0438 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a PVS-Studio?<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u043d \u0438 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u0443\u0447\u0430\u0442\u0441\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430.<\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442: \u0434\u0430. \u0415\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430. \u042d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0443\u0447\u0430\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430. \u0421\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0448\u0430\u044e\u0442 \u0443\u0437\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u043f\u043e\u0438\u0441\u043a \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0410 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043d\u0438 \u0440\u0435\u0448\u0430\u044e\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0442\u0432\u0435\u0442. \u0410 \u043a\u0430\u043a \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435?<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u0445 \u043a\u043e\u0434\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0437\u043d\u0430\u0447\u0438\u0442, PVS-Studio \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u044b\u0439 \u0438 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li>2021 \u2014 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0871\/\">LLVM 13.0<\/a>;<\/li>\n<li>2020 \u2014 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0727\/\">GCC 10<\/a>;<\/li>\n<li>2020 \u2014 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0771\/\">LLVM 11<\/a>;<\/li>\n<li>2019 \u2014 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/csharp\/0622\/\">Roslyn<\/a>;<\/li>\n<li>2019 \u2014 <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0629\/\">LLVM 8<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 LLVM 14 \u043c\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438, \u043d\u043e \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u0442\u043a\u0443, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 LLVM 15.<\/p>\n<p>  <\/p>\n<p><strong><a href=\"https:\/\/ru.wikipedia.org\/wiki\/LLVM\">\u0421\u043f\u0440\u0430\u0432\u043a\u0430 \u0438\u0437 Wikipedia<\/a>.<\/strong> LLVM \u2014 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0438 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043c \u0443\u0442\u0438\u043b\u0438\u0442. \u0421\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0438\u0437 \u044f\u0437\u044b\u043a\u043e\u0432 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C, C++ \u0438 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0435. \u0421\u0430\u0439\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430: <a href=\"https:\/\/llvm.org\/\">llvm.org.<\/a><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 LLVM \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f <a href=\"https:\/\/clang.llvm.org\/diagnostics.html\">\u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/a> \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 Clang. LLVM \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/clang-analyzer.llvm.org\/\">Clang Static Analyzer<\/a> \u0438 <a href=\"https:\/\/clang.llvm.org\/extra\/clang-tidy\/\">clang-tidy<\/a>. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u043e\u0435\u043a\u0442 LLVM \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e <a href=\"https:\/\/scan.coverity.com\/projects\/llvm\">\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u043f\u0440\u0438\u0435\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 Coverity.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0432 LLVM \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435. \u0418 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u043d\u0430 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d!<\/p>\n<p>  <\/p>\n<h2 id=\"analiz-proekta-preduprezhdeniya-lozhnye-srabatyvaniya\">\u0410\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>LLVM \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0432\u044b\u0434\u0430\u0451\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u043e\u0436\u043d\u044b\u0445 \u0438\u043b\u0438 \u043c\u0430\u043b\u043e\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c PVS-Studio \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0442\u043e \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0433\u043b\u043e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0441\u044b\u0440\u043e\u0439 \u043e\u0442\u0447\u0451\u0442.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c. \u041d\u0430\u0434\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0435\u0439 \u0446\u0435\u043b\u044c\u044e \u0431\u044b\u043b\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e :). \u0418 \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f. \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u044f \u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#171;<a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/0743\/\">\u041a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430 \u0432 legacy \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043d\u0435 \u0434\u0435\u043c\u043e\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/a>&#171;.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a \u0432 \u043e\u0442\u0447\u0451\u0442\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/terms\/6461\/\">\u043b\u043e\u0436\u043d\u043e-\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f<\/a>. \u0421 \u044d\u0442\u0438\u043c\u0438 \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0438\u0445 \u0432\u044b\u0434\u0430\u0451\u0442. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 LLVM \u044f \u0443\u0432\u0438\u0434\u0435\u043b \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043b\u043e\u0436\u043d\u044b\u043c\u0438. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0430\u0432. \u041d\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438 \u044d\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435.<\/p>\n<p>  <\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u0442\u0438\u043d\u043d\u044b \u0438\u043b\u0438 \u043b\u043e\u0436\u043d\u044b. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u044f \u0434\u0430\u0436\u0435 \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v547\/\">V547 \u2014 Expression is always true\/false<\/a>. \u042d\u0442\u043e \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u043f\u0430\u0440\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u044f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int L = -1, V = -1, T = -1; if (L != -1 &amp;&amp; V != -1 &amp;&amp; T != -1 &amp;&amp; Name.empty()) {  \/\/ &lt;=   if (!Strict) {     Buffer.append(\"HANGUL SYLLABLE \");     if (L != -1)                                      \/\/ &lt;=       Buffer.append(HangulSyllables[L][0]);     if (V != -1)                                      \/\/ &lt;=       Buffer.append(HangulSyllables[V][1]);     if (T != -1)                                      \/\/ &lt;=       Buffer.append(HangulSyllables[T][2]);   }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u0451\u0442 \u0441\u0440\u0430\u0437\u0443 3 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>V547 [CWE-571] Expression &#8216;L != \u2014 1&#8217; is always true. UnicodeNameToCodepoint.cpp 306<\/li>\n<li>V547 [CWE-571] Expression &#8216;V != \u2014 1&#8217; is always true. UnicodeNameToCodepoint.cpp 308<\/li>\n<li>V547 [CWE-571] Expression &#8216;T != \u2014 1&#8217; is always true. UnicodeNameToCodepoint.cpp 310<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <em>L<\/em>, <em>V<\/em>, <em>T<\/em> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0434\u0432\u0430\u0436\u0434\u044b. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b, \u043d\u043e \u0438 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u044d\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">while (top_reader_sp) {   if (!top_reader_sp)     break;   top_reader_sp->Run();<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435: V547 [CWE-570] Expression &#8216;!top_reader_sp&#8217; is always false. Debugger.cpp 1042<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430. \u042d\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u043e\u043a \u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430. \u041a\u043e\u0434 \u043c\u0435\u043d\u044f\u043b\u0441\u044f, \u043c\u0435\u043d\u044f\u043b\u0441\u044f \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0442\u0430\u043b \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c. \u0414\u0430, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0430\u0442\u0430\u0432\u0438\u0437\u043c\u043e\u043c, \u043d\u043e \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u0442\u044f\u043d\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u044b. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u0421 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0432\u0441\u0451 \u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<h2 id=\"42-oshibki-v-kode-llvm\">42 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043a\u043e\u0434\u0435 LLVM<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 42? \u041f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e &#171;42 \u2014 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0436\u0438\u0437\u043d\u0438, \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0438 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e&#187; :). \u0412\u044b\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043e\u0448\u0438\u0431\u043e\u043a \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0414\u0430 \u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u043e\u0440\u043e\u0432\u044b\u0439 \u043e\u0442\u0447\u0451\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u041d\u0443 \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c LLVM\u2026 \u041d\u043e \u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N1<\/strong><\/p>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u0445, \u0447\u0442\u043e \u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#171;<a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0509\/\">\u0417\u043b\u043e \u0436\u0438\u0432\u0451\u0442 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f<\/a>&#171;. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0443\u0442\u044c \u0432 \u0442\u043e\u043c \u0436\u0435. \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u044f\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043a\u0443\u0447\u043d\u0430, \u0438 \u0435\u0451 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 code review. \u0418 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0435\u0439 \u0435\u0441\u0442\u044c \u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e, \u043a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0443\u0441\u0442\u0430\u0451\u0442 \u0438 \u043d\u0435 \u043b\u0435\u043d\u0438\u0442\u0441\u044f :).<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static bool isCopyCompatibleType(LLT SrcTy, LLT DstTy) {   if (SrcTy == DstTy)     return true;    if (SrcTy.getSizeInBits() != DstTy.getSizeInBits())     return false;    SrcTy = SrcTy.getScalarType();   DstTy = DstTy.getScalarType();    return (SrcTy.isPointer() &amp;&amp; DstTy.isScalar()) ||          (DstTy.isScalar() &amp;&amp; SrcTy.isPointer()); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V501 [CWE-570] There are identical sub-expressions &#8216;(SrcTy.isPointer() &amp;&amp; DstTy.isScalar())&#8217; to the left and to the right of the &#8216;||&#8217; operator. CallLowering.cpp 1198<\/p>\n<p>  <\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0434\u0435\u0441\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">(SrcTy.isPointer() &amp;&amp; DstTy.isScalar()) || (DstTy.isScalar()  &amp;&amp; SrcTy.isPointer())<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 <em>Src<\/em> \u043d\u0430 <em>Dst<\/em> \u0438 <em>Pointer<\/em> \u043d\u0430 <em>Scalar<\/em>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435! \u041a\u043e\u0434 \u0432\u044b\u0448\u0435 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">(SrcTy.isPointer() &amp;&amp; DstTy.isScalar()) || (SrcTy.isPointer() &amp;&amp; DstTy.isScalar())<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">(SrcTy.isPointer() &amp;&amp; DstTy.isScalar()) || (SrcTy.isScalar()  &amp;&amp; DstTy.isPointer())<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N2<\/strong><\/p>\n<p>  <\/p>\n<p>\u0418 \u0441\u0440\u0430\u0437\u0443 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0440\u043e\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static ValueKnowledge meet(const ValueKnowledge &amp;lhs,                            const ValueKnowledge &amp;rhs) {   ValueKnowledge result = getPessimisticValueState();   result.hasError = true;    if (!rhs || !rhs || lhs.dtype != rhs.dtype)   \/\/ &lt;=     return result;    result.hasError = false;   result.dtype = lhs.dtype;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V501 [CWE-570] There are identical sub-expressions to the left and to the right of the &#8216;||&#8217; operator: !rhs ||!rhs ShapeUtils.h 141<\/p>\n<p>  <\/p>\n<p>\u0414\u0432\u0430\u0436\u0434\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <em>rhs<\/em>, \u0430 <em>lhs<\/em> \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f. \u041e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u043f\u0435\u0448\u043a\u0430 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 code review.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N3<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::optional&lt;parser::MessageFixedText> Scope::SetImportKind(ImportKind kind) {   ....   } else if (kind != *importKind_ &amp;&amp;       (kind != ImportKind::Only || kind != ImportKind::Only)) {     return        \"Every IMPORT must have ONLY specifier if one of them does\"_err_en_US;   } else {   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V501 [CWE-570] There are identical sub-expressions &#8216;kind != ImportKind::Only&#8217; to the left and to the right of the &#8216;||&#8217; operator. scope.cpp 275<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u044f\u0432\u043d\u0430\u044f \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430. \u0414\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0435\u0449\u0451 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430, \u043f\u043e\u043c\u0438\u043c\u043e <em>ImportKind::Only<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 &#171;\u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0430&#187;, \u0430 \u043d\u0435 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u0448\u0438\u0431\u043a\u0443 \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u0435\u0433\u0447\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c. \u0421\u043c. <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0391\/\">\u0433\u043b\u0430\u0432\u0443 13. \u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0439\u0442\u0435 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0439 \u043a\u043e\u0434 &#171;\u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439&#187;<\/a> \ud83d\ude42 \u042f \u0431\u044b \u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">} else if (kind != *importKind_ &amp;&amp;     (   kind != ImportKind::Only      || kind != ImportKind::Only)) {   return ....;<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N4<\/strong><\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044f \u043d\u0435 \u0438\u043c\u0435\u044e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 LLVM, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u0435\u043d. \u042f \u0438\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u0442\u043e, \u0447\u0442\u043e, \u0445\u043e\u0442\u044f \u044f \u0432\u0438\u0436\u0443, \u0447\u0442\u043e \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043e\u0447\u0435\u043d, \u044f \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u044e\u0441\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool Merger::maybeZero(unsigned e) const {   if (tensorExps[e].kind == kInvariant) {     if (auto c = tensorExps[e].val.getDefiningOp&lt;complex::ConstantOp>()) {       ArrayAttr arrayAttr = c.getValue();       return arrayAttr[0].cast&lt;FloatAttr>().getValue().isZero() &amp;&amp;              arrayAttr[0].cast&lt;FloatAttr>().getValue().isZero();     }     if (auto c = tensorExps[e].val.getDefiningOp&lt;arith::ConstantIntOp>())       return c.value() == 0;     if (auto c = tensorExps[e].val.getDefiningOp&lt;arith::ConstantFloatOp>())       return c.value().isZero();   }   return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V501 [CWE-571] There are identical sub-expressions &#8216;arrayAttr[0].cast &lt; FloatAttr > ().getValue().isZero()&#8217; to the left and to the right of the &#8216;&amp;&amp;&#8217; operator. Merger.cpp 812<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u043c\u0435\u0441\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">return arrayAttr[0].cast&lt;FloatAttr>().getValue().isZero() &amp;&amp;        arrayAttr[0].cast&lt;FloatAttr>().getValue().isZero();<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N5<\/strong><\/p>\n<p>  <\/p>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u043e\u0439 V501.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">template &lt;int KIND> Expr&lt;Type&lt;TypeCategory::Logical, KIND>> FoldIntrinsicFunction(....) {   ....   } else if (name == \"__builtin_ieee_support_datatype\" ||       name == \"__builtin_ieee_support_denormal\" ||       name == \"__builtin_ieee_support_divide\" ||     \/\/ &lt;=       name == \"__builtin_ieee_support_divide\" ||     \/\/ &lt;=       name == \"__builtin_ieee_support_inf\" ||       name == \"__builtin_ieee_support_io\" ||       name == \"__builtin_ieee_support_nan\" ||       name == \"__builtin_ieee_support_sqrt\" ||       name == \"__builtin_ieee_support_standard\" ||       name == \"__builtin_ieee_support_subnormal\" ||       name == \"__builtin_ieee_support_underflow_control\") {     return Expr&lt;T>{true};   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V501 [CWE-570] There are identical sub-expressions &#8216;name == &#171;__builtin_ieee_support_divide&#187;&#8216; to the left and to the right of the &#8216;||&#8217; operator. fold-logical.cpp 218<\/p>\n<p>  <\/p>\n<p>\u042f \u043f\u043e\u043c\u0435\u0442\u0438\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c \u0434\u0432\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u0438\u0448\u043d\u044f\u044f. \u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0430 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u0431\u044b\u043b\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c <em>name<\/em> \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N6<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <em>bmap<\/em> \u2014 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct isl_coalesce_info {   isl_basic_map *bmap;   .... };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u044d\u0442\u043e\u0433\u043e \u0447\u043b\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static isl_stat tab_insert_divs(struct isl_coalesce_info *info, ....) {   ....   if (any) {     if (isl_tab_rollback(info->tab, snap) &lt; 0)       return isl_stat_error;     info->bmap = isl_basic_map_cow(info->bmap);     info->bmap = isl_basic_map_free_inequality(info->bmap, 2 * n);      if (info->bmap &lt; 0)                 \/\/ &lt;=       return isl_stat_error;      return fix_constant_divs(info, n, expanded);   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V503 [CWE-697, CERT-EXP08-C] This is a nonsensical comparison: pointer &lt; 0. isl_coalesce.c 3181<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 &#171;\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c &lt; 0&#187;. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u0438\u043b\u0438 \u043a\u043e\u0434 \u043d\u0435 \u0434\u043e\u043f\u0438\u0441\u0430\u043d. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 0 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0437 \u0447\u043b\u0435\u043d\u043e\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <em>isl_basic_map<\/em>. <\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N7<\/strong><\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0434\u043a\u0430\u044f \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0431\u044b\u043b\u043e \u0432\u0441\u0435\u0433\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/examples\/v504\/\">\u0434\u0432\u0430 \u0442\u0430\u043a\u0438\u0445 \u0431\u0430\u0433\u0430<\/a>, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {   ....   Register DestReg = It->second;   if (DestReg == 0)     return   assert(Register::isVirtualRegister(DestReg) &amp;&amp;          \"Expected a virtual reg\");   LiveOutRegInfo.grow(DestReg);   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V504 [CWE-841] It is highly probable that the semicolon &#8216;;&#8217; is missing after &#8216;return&#8217; keyword. FunctionLoweringInfo.cpp 454<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0433, \u0445\u043e\u0442\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0439. \u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>return<\/em> \u043d\u0435\u0442 \u0442\u043e\u0447\u043a\u0438 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <em>assert<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <em>DestReg == 0<\/em>. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, assert \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 <em>DestReg == 0<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u0442\u0440\u0430\u0448\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437-\u0437\u0430 \u0432\u0435\u0437\u0435\u043d\u0438\u044f. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, <em>assert<\/em> \u043d\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0410 \u0432 release-\u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u043d \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0438\u0447\u0442\u043e.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N8, N9<\/strong><\/p>\n<p>  <\/p>\n<p>\u041d\u0435 \u0438\u0437\u0443\u0447\u0430\u043b \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u044d\u0442\u043e &#171;\u043a\u0430\u043b\u044c\u043a\u0430 \u0441 <em>malloc<\/em>&#171;. \u0422.\u0435. \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>malloc<\/em>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0451 \u0433\u0440\u0443\u0431\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 <em>new<\/em> \u0438 <em>shared_ptr<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::shared_ptr&lt;uint8_t> RenderScriptRuntime::GetAllocationData(....) {   ....   const uint32_t size = *alloc->size.get();   std::shared_ptr&lt;uint8_t> buffer(new uint8_t[size]);   if (!buffer) {     LLDB_LOGF(log, \"%s - couldn't allocate a %\" PRIu32 \" byte buffer\",               __FUNCTION__, size);     return nullptr;   }   ....   return buffer; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V554 [CWE-762, CERT-MEM51-CPP] Incorrect use of shared_ptr. The memory allocated with &#8216;new []&#8217; will be cleaned using &#8216;delete&#8217;. RenderScriptRuntime.cpp 2371<\/p>\n<p>  <\/p>\n<p>\u0423\u043c\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>std::shared_ptr<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::shared_ptr&lt;uint8_t> buffer(new uint8_t[size]);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u043c\u044f\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>delete<\/em>, \u0430 \u043d\u0435 <em>delete []<\/em>, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0441\u043c. \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#171;<a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0973\/\">\u041f\u043e\u0447\u0435\u043c\u0443 \u0432 \u0421++ \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 delete[]<\/a>&#171;. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::shared_ptr&lt;uint8_t []> buffer(new uint8_t[size]);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u044f\u0441\u043d\u044f\u044e, \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <em>malloc<\/em>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>nullptr<\/em>. \u041e\u043d\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u043e\u0448\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <em>std::bad_alloc<\/em>. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u2014 \u0430\u0442\u0430\u0432\u0438\u0437\u043c.<\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435 &#171;\u043a\u0430\u043b\u044c\u043a\u0430 \u0441 <em>malloc<\/em>&#171;: V554 [CWE-762, CERT-MEM51-CPP] Incorrect use of shared_ptr. The memory allocated with &#8216;new []&#8217; will be cleaned using &#8216;delete&#8217;. RenderScriptRuntime.cpp 2698<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N10<\/strong><\/p>\n<p>  <\/p>\n<p>\u041e\u0439, \u044f \u0434\u0430\u0432\u043d\u043e \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u0441\u0442\u043e\u043b\u044c \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438 \u0437\u0430\u0431\u0430\u0432\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443! \u041e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0436\u0435\u043c\u0447\u0443\u0436\u0438\u043d\u0430 \u0441\u0440\u0435\u0434\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a!<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/fb8\/f8b\/45a\/fb8f8b45a5aeea807519c1113a7471c4.webp\" alt=\"1003_LLVM_15_ru\/image2.webp\"\/><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">OwningMemRef &amp;operator=(const OwningMemRef &amp;&amp;other) {   freeFunc = other.freeFunc;   descriptor = other.descriptor;   other.freeFunc = nullptr;   memset(0, &amp;other.descriptor, sizeof(other.descriptor)); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V575 [CWE-628, CERT-EXP37-C] The null pointer is passed into &#8216;memset&#8217; function. Inspect the first argument. MemRefUtils.h 194<\/p>\n<p>  <\/p>\n<p>\u042f \u043e\u043f\u0438\u0441\u0430\u043b \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>memset,<\/em> \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#171;<a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0360\/\">\u0421\u0430\u043c\u0430\u044f \u043e\u043f\u0430\u0441\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 \u043c\u0438\u0440\u0435 \u0421\/\u0421++<\/a>&#171;. \u041d\u043e \u044d\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u0435\u043d\u044c\u043a\u043e\u0435!<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043f\u0443\u0442\u0430\u043d \u043f\u0435\u0440\u0432\u044b\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0417\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043f\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0436\u0438\u0434\u0430\u0435\u0442 <em>int<\/em>. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435. \u0418 \u043f\u043e\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043e\u043d\u0430 \u043d\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u043e\u043a\u0430 \u043e\u043d \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e, \u043d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N11-N17<\/strong><\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u044b\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0434\u0435\u0444\u0435\u043a\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0434\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432 \u0431\u0430\u0437\u0435 \u043e\u0448\u0438\u0431\u043e\u043a <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v595\/\">\u0432\u044b\u043f\u0438\u0441\u0430\u043d\u043e<\/a> \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b LLVM \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void LibCallSimplifier::classifyArgUse(....) {   CallInst *CI = dyn_cast&lt;CallInst>(Val);   Module *M = CI->getModule();    if (!CI || CI->use_empty())     return;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V595 [CWE-476, CERT-EXP12-C] The &#8216;CI&#8217; pointer was utilized before it was verified against nullptr. Check lines: 2515, 2517. SimplifyLibCalls.cpp 2515<\/p>\n<p>  <\/p>\n<p>\u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>CI<\/em> \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: <em>CI->getModule()<\/em>. \u0418 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>nullptr<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void Module::FindFunctions(....) {   ....   for (size_t i = 0; i &lt; num_matches; ++i) {     sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);     SymbolType sym_type = sc.symbol->GetType();     if (sc.symbol &amp;&amp; (sym_type == eSymbolTypeCode ||                       sym_type == eSymbolTypeResolver))       sc_list.Append(sc);   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V595 [CWE-476, CERT-EXP12-C] The &#8216;sc.symbol&#8217; pointer was utilized before it was verified against nullptr. Check lines: 877, 878. Module.cpp 877<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0442\u0438\u043f \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>sym_type<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">SymbolType sym_type = sc.symbol->GetType();<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e, \u043d\u0435 \u0443\u0447\u0442\u044f, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>sc.symbol<\/em> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u043c. \u042d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">if (sc.symbol &amp;&amp; (sym_type == eSymbolTypeCode ||                   sym_type == eSymbolTypeResolver))<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f V595.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041d\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u043f\u044f\u0442\u043e\u043a \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>V595 [CWE-476, CERT-EXP12-C] The &#8216;sc.symbol&#8217; pointer was utilized before it was verified against nullptr. Check lines: 899, 900. Module.cpp 899<\/li>\n<li>V595 [CWE-476, CERT-EXP12-C] The &#8216;process&#8217; pointer was utilized before it was verified against nullptr. Check lines: 159, 184. IRExecutionUnit.cpp 159<\/li>\n<li>V595 [CWE-476, CERT-EXP12-C] The &#8216;localVarCst&#8217; pointer was utilized before it was verified against nullptr. Check lines: 77, 96. AffineStructures.cpp 77<\/li>\n<li>V595 [CWE-476, CERT-EXP12-C] The &#8216;Class&#8217; pointer was utilized before it was verified against nullptr. Check lines: 58, 60. Transforms.cpp 58<\/li>\n<li>V595 [CWE-476, CERT-EXP12-C] The &#8216;CurPPLexer&#8217; pointer was utilized before it was verified against nullptr. Check lines: 739, 743. PPDirectives.cpp 739<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u0448\u0438\u0431\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435. \u042f \u043d\u0435 \u0432\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0441\u044f. \u0418\u0445 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0438 \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u2014 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0438\u0445, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0435.<\/li>\n<\/ul>\n<\/div><\/div>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N18<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Optional&lt;SmallVector&lt;ReassociationIndices>> mlir::getReassociationIndicesForCollapse(ArrayRef&lt;int64_t> sourceShape,                                          ArrayRef&lt;int64_t> targetShape) {   unsigned sourceDim = 0;   ....   int64_t currTargetShape = targetShape[targetDim];   while (sourceShape[sourceDim] != ShapedType::kDynamicSize &amp;&amp;          prodOfCollapsedDims * sourceShape[sourceDim] &lt; currTargetShape &amp;&amp;          sourceDim &lt; sourceShape.size()) {     prodOfCollapsedDims *= sourceShape[sourceDim];     currIndices.push_back(sourceDim++);   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V781 [CWE-20, CERT-API00-C] The value of the &#8216;sourceDim&#8217; index is checked after it was used. Perhaps there is a mistake in program logic. ReshapeOpsUtils.cpp 49<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0446\u0438\u043a\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">sourceShape[sourceDim] != ShapedType::kDynamicSize &amp;&amp; .... &amp;&amp; sourceDim &lt; sourceShape.size()<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0411\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">sourceDim &lt; sourceShape.size() &amp;&amp; sourceShape[sourceDim] != ShapedType::kDynamicSize &amp;&amp; ....<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N19-N36<\/strong><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u043e\u0441\u044c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u043c\u0435\u043b\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u043b\u0435\u043d\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u0434\u0440\u0443\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>nullptr<\/em> \u0432 \u0442\u0435\u043b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">typedef std::shared_ptr&lt;lldb_private::ValueObject> ValueObjectSP;  lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::     LibCxxMapIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)     : SyntheticChildrenFrontEnd(*valobj_sp), m_pair_ptr(), m_pair_sp() {   if (valobj_sp)     Update(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 211, 212. LibCxx.cpp 211<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u0445\u043e\u0436\u0438\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 381, 382. LibCxx.cpp 381<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 551, 552. LibCxx.cpp 551<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 635, 636. LibCxx.cpp 635<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 49, 50. LibCxxInitializerList.cpp 49<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 70, 71. LibCxxSpan.cpp 70<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 311, 312. LibCxxList.cpp 311<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 207, 208. LibCxxMap.cpp 207<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 71, 72. LibCxxVector.cpp 71<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 174, 176. LibCxxVector.cpp 174<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 57, 59. LibCxxUnorderedMap.cpp 57<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 80, 82. LibStdcpp.cpp 80<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 183, 185. LibStdcpp.cpp 183<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 354, 355. LibStdcpp.cpp 354<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 464, 465. NSArray.cpp 464<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 608, 610. NSArray.cpp 608<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 404, 405. NSSet.cpp 404<\/li>\n<li>V664 [CWE-476, CERT-EXP34-C] The &#8216;valobj_sp&#8217; pointer is being dereferenced on the initialization list before it is verified against null inside the body of the constructor function. Check lines: 671, 673. NSSet.cpp 671<\/li>\n<\/ul>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u0434 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412\u044a\u0435\u0434\u043b\u0438\u0432\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c, \u0447\u0442\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 <em>SyntheticChildrenFrontEnd<\/em> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c <em>nullptr<\/em>, \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0438\u043a\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \u043d\u0435 &#171;\u0442\u0440\u043e\u0433\u0430\u0442\u044c&#187; \u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443, \u0442\u043e \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u041d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043d\u043e \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0442, \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043b\u044c\u0437\u044f. \u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0418 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u043e \u043f\u0440\u043e\u044f\u0432\u0438\u0442 \u0441\u0435\u0431\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0438\u0434\u0438\u0442, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0417\u043d\u0430\u0447\u0438\u0442, \u043e\u043d \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0439. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u0446\u0435\u043b\u044f\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 &#171;<em>if (valobj_sp)<\/em>&#187; \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#171;<a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0306\/\">\u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e<\/a>&#171;. \u0418 \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u043f\u0440\u043e \u044d\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f &#171;<a href=\"http:\/\/blog.llvm.org\/2011\/05\/what-every-c-programmer-should-know_14.html\">What Every C Programmer Should Know About Undefined Behavior #2\/3<\/a>&#171;.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N37<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">uint64_t NullabilityPayload = 0;  static constexpr const unsigned NullabilityKindMask = 0x3;  void addTypeInfo(unsigned index, NullabilityKind kind) {   ....   NullabilityPayload &amp;=     ~(NullabilityKindMask &lt;&lt; (index * NullabilityKindSize));   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V784 [CWE-197, CERT-INT31-C] The size of the bit mask is less than the size of the first operand. This will cause the loss of higher bits. Types.h 529<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>NullabilityPayload<\/em> \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u044b. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u044f\u0441\u043d\u044e, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>NullabilityKindMask<\/em> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 32-\u0431\u0438\u0442\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c <em>unsigned<\/em>. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0441\u0434\u0432\u0438\u0433\u0430\u0439 \u0431\u0438\u0442\u044b \u0432 \u044d\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0438\u043f <em>unsigned<\/em>. \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u041d\u0415 (~) \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0442\u0438\u043f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>&amp;=<\/em> \u0442\u0438\u043f <em>unsigned<\/em> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d \u0434\u043e \u0442\u0438\u043f\u0430 <em>uint64_t<\/em>. \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0438\u043f \u0431\u044b\u043b \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439, \u0442\u043e \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b 64-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">NullabilityPayload &amp;= 0x00000000xxxxxxxx;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0441\u0431\u0440\u043e\u0441\u0443 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442\u043e\u0432 \u0432 <em>NullabilityPayload<\/em>. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">NullabilityPayload &amp;=   ~(static_cast&lt;uint64_t>(NullabilityKindMask)      &lt;&lt; (index * NullabilityKindSize));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u2014 \u044d\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 <em>NullabilityKindMask<\/em> 64-\u0431\u0438\u0442\u043d\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static constexpr const uint64_t NullabilityKindMask = 0x3; .... NullabilityPayload &amp;=   ~(NullabilityKindMask &lt;&lt; (index * NullabilityKindSize));<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N38<\/strong><\/p>\n<p>  <\/p>\n<p>\u0411\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u043e\u0441\u044c. \u042d\u0442\u043e, \u043a\u0441\u0442\u0430\u0442\u0438, \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u044e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A0%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B0_%D1%87%D0%B5%D1%80%D0%B5%D0%B7_%D1%82%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\">TDD<\/a>. \u0412\u0435\u0434\u044c \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043f\u0438\u0448\u0435\u0442 \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u0442\u0435\u0441\u0442\u044b :). \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043e\u0434\u0435, \u043d\u043e \u0438 \u0432 \u0442\u0435\u0441\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">TEST(RegisterContextMinidump, ConvertMinidumpContext_x86_64) {   MinidumpContext_x86_64 Context;   ....   Context.rax = 0x0001020304050607;   Context.rbx = 0x08090a0b0c0d0e0f;   ....   Context.eflags = 0x88898a8b;   Context.cs = 0x8c8d;   Context.fs = 0x8e8f;   Context.gs = 0x9091;   Context.ss = 0x9293;   Context.ds = 0x9495;   Context.ss = 0x9697;   llvm::ArrayRef&lt;uint8_t> ContextRef(reinterpret_cast&lt;uint8_t *>(&amp;Context),                                      sizeof(Context));   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V519 [CWE-563, CERT-MSC13-C] The &#8216;Context.ss&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 110, 112. RegisterContextMinidumpTest.cpp 112<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u043e\u0442 \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Context.ss = 0x9293; .... Context.ss = 0x9697;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043f\u0435\u0447\u0430\u0442\u043a\u0430. \u0412 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043f\u043e \u0432\u0441\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <em>Context.es<\/em>.<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N39, N40<\/strong><\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0447\u0442\u043e \u043d\u0435 \u0441\u0442\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a V547. \u041d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u044f \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0438\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443. \u0415\u0451 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 data-flow \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u043e\u0447\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0437\u0430\u043c\u0435\u0442\u043a\u0443 &#171;<a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/0908\/\">\u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 PVS-Studio<\/a>&#171;.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static std::unordered_multimap&lt;char32_t, std::string> loadDataFiles(const std::string &amp;NamesFile, const std::string &amp;AliasesFile) {   ....   auto FirstSemiPos = Line.find(';');   if (FirstSemiPos == std::string::npos)                   \/\/ &lt;=     continue;   auto SecondSemiPos = Line.find(';', FirstSemiPos + 1);   if (FirstSemiPos == std::string::npos)                   \/\/ &lt;=     continue;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V547 [CWE-570] Expression &#8216;FirstSemiPos == std::string::npos&#8217; is always false. UnicodeNameMappingGenerator.cpp 46<\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Copy-Paste. \u0411\u044b\u043b \u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0435\u043d \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">auto FirstSemiPos = Line.find(';'); if (FirstSemiPos == std::string::npos)   continue;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>find<\/em>. <em>First<\/em> \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 <em>Second<\/em>, \u043d\u043e \u043d\u0435 \u0432\u0435\u0437\u0434\u0435. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0430<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">if (FirstSemiPos == std::string::npos)<\/code><\/pre>\n<p>  <\/p>\n<p>\u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0443\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u043e. \u0422\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 code review, \u043d\u043e \u043e\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043f\u0440\u044f\u043c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Status Host::ShellExpandArguments(ProcessLaunchInfo &amp;launch_info) {   ....   auto data_sp = StructuredData::ParseJSON(output);   if (!data_sp) {                                        \/\/ &lt;=     error.SetErrorString(\"invalid JSON\");     return error;   }    auto dict_sp = data_sp->GetAsDictionary();   if (!data_sp) {                                        \/\/ &lt;=     error.SetErrorString(\"invalid JSON\");     return error;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V547 [CWE-570] Expression &#8216;!data_sp&#8217; is always false. Host.cpp 248<\/p>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N41<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (data-flow \u0430\u043d\u0430\u043b\u0438\u0437). \u0414\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u0438\u0437\u043e\u0449\u0440\u0451\u043d\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u0438\u043a\u0430: \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (symbolic execution). \u0421\u043c\u044b\u0441\u043b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\/\u043b\u043e\u0436\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void Sema::adjustMemberFunctionCC(QualType &amp;T, bool IsStatic, bool IsCtorOrDtor,                                   SourceLocation Loc) {   ....   CallingConv CurCC = FT->getCallConv();   CallingConv ToCC = Context.getDefaultCallingConvention(IsVariadic, !IsStatic);    if (CurCC == ToCC)     return;   ....   CallingConv DefaultCC =      Context.getDefaultCallingConvention(IsVariadic, IsStatic);    if (CurCC != DefaultCC || DefaultCC == ToCC)     return;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V560 [CWE-570] A part of conditional expression is always false: DefaultCC == ToCC. SemaType.cpp 7856<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u0430. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0443\u0431\u0435\u0440\u0451\u043c \u0432\u0441\u0451 \u043b\u0438\u0448\u043d\u0435\u0435 \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0438\u043c\u0435\u043d\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">A = ....; B = ....; if (A == B) return; C = ....; if (A != C || C == B)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0435\u0441\u0442\u044c 3 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 A, B, C, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u043c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b;<\/li>\n<li>\u043d\u043e \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 A == B, \u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438;<\/li>\n<li>\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f, \u0442\u043e A != B;<\/li>\n<li>\u0435\u0441\u043b\u0438 A != C, \u0442\u043e, \u0432 \u0441\u0438\u043b\u0443 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%92%D1%8B%D1%87%D0%B8%D1%81%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F_%D0%BF%D0%BE_%D0%BA%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%BE%D0%B9_%D1%81%D1%85%D0%B5%D0%BC%D0%B5\">\u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0439 \u0441\u0445\u0435\u043c\u0435<\/a>, \u043f\u0440\u0430\u0432\u043e\u0435 \u043f\u043e\u0434\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f;<\/li>\n<li>\u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u043e\u0435 \u043f\u043e\u0434\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 &#171;C == B&#187; \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f, \u0437\u043d\u0430\u0447\u0438\u0442 A == C;<\/li>\n<li>\u0435\u0441\u043b\u0438 A != B \u0438 A == C, \u0442\u043e \u0421 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u043d\u043e B.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430 \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0438, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">if (CurCC != DefaultCC || DefaultCC != ToCC)<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N42<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0442\u0440\u0430\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u043c \u0431\u0430\u0433\u043e\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">ObjectFileMachO::MachOCorefileAllImageInfos ObjectFileMachO::GetCorefileAllImageInfos() {   ....   lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);   ....   uint32_t imgcount = m_data.GetU32(&amp;offset);   uint64_t entries_fileoff = m_data.GetU64(&amp;offset);   offset += 4; \/\/ uint32_t entries_size;   offset += 4; \/\/ uint32_t unused;   offset = entries_fileoff;                  \/\/ &lt;=   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: V519 [CWE-563, CERT-MSC13-C] The &#8216;offset&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 6888, 6890. ObjectFileMachO.cpp 6890<\/p>\n<p>  <\/p>\n<p>\u041e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0447\u0442\u043e-\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>offset<\/em>, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u0437\u044f\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0442\u0435\u0440\u0435\u0442\u044c \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">offset += 4; \/\/ uint32_t entries_size; offset += 4; \/\/ uint32_t unused; offset += entries_fileoff;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"skachayte-i-poprobuyte-pvs-studio\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 PVS-Studio<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2014 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio. \u041e\u043d \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u044f\u0432\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0448\u0438\u0431\u043e\u043a. <a href=\"https:\/\/pvs-studio.com\/ru\/pvs-studio\/try-free\/?utm_source=website&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=1003&amp;utm_term=link_try-free\">\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c PVS-Studio<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/pvs-studio.com\/ru\/subscribe\/\">\u0435\u0436\u0435\u043c\u0435\u0441\u044f\u0447\u043d\u0443\u044e \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 PVS-Studio.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Andrey Karpov. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/1003\/\">Examples of errors that PVS-Studio found in LLVM 15.0<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/695426\/\"> https:\/\/habr.com\/ru\/articles\/695426\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/tv\/np\/ae\/tvnpaer1umvhcbelxvnzaccw_oq.png\" alt=\"PVS-Studio: \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043e\u0433\u0443\" data-src=\"https:\/\/habrastorage.org\/webt\/tv\/np\/ae\/tvnpaer1umvhcbelxvnzaccw_oq.png\"\/><br \/>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u0432\u044b\u0434\u0430\u044e\u0442 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439. \u041e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043b\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a PVS-Studio? \u0414\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0442\u043e\u0436\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0442\u0441\u044f. \u041f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a PVS-Studio \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0431\u0430\u0433\u0438 \u0434\u0430\u0436\u0435 \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-397568","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/397568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=397568"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/397568\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=397568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=397568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=397568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}