{"id":378603,"date":"2024-06-11T09:00:53","date_gmt":"2024-06-11T09:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=378603"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=378603","title":{"rendered":"<span>\u0421\u043a\u043e\u043b\u044c\u043a\u043e UB \u0432 \u043c\u043e\u0451\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435?<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0423 C \u0438 C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0434\u0432\u0435 \u0433\u043e\u043b\u043e\u0432\u043d\u044b\u0435 \u0431\u043e\u043b\u0438 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u0448\u0438\u0431\u043e\u043a: \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0418 \u043a\u0430\u043a \u0432\u044b \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438. \u0418 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e &#171;\u043c\u043e\u0451\u043c&#187; \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435. \u0415\u0441\u043b\u0438 \u0442\u043e\u0447\u043d\u0435\u0435, \u0442\u043e \u043e \u043d\u0430\u0431\u043e\u0440\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0434\u043b\u044f \u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e LLVM. \u041f\u043e\u0447\u0435\u043c\u0443 &#171;\u043c\u043e\u0451\u043c&#187;? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u0438\u043c Clang, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 LLVM, \u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c \u043d\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/520\/b99\/f7d\/520b99f7df281377021d11ae467a5121.png\" width=\"1600\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/520\/b99\/f7d\/520b99f7df281377021d11ae467a5121.png\"\/><\/figure>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u043a\u043e\u0434 LLVM \u0438 \u0434\u0430\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1126\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>. \u042d\u0442\u043e \u0435\u0451 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c.<\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/strong><\/p>\n<p>\u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 Undefined Behavior (UB) \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u044f\u0437\u044b\u043a\u0430, \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0410 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0412\u0435\u0434\u044c UB \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u043e \u0442\u0432\u043e\u0435\u043c\u0443 \u043a\u043e\u0434\u0443.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0432\u0441\u0451 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u041f\u043e\u0440\u043e\u0439 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u0438 \u0445\u043e\u0442\u0435\u043b\u0438. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043c\u0435\u043b\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0438 \u0432\u0430\u043c \u043f\u043e\u0432\u0435\u0437\u043b\u043e.<\/p>\n<p>UB \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0438\u0437-\u0437\u0430 \u0446\u0435\u043b\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u043f\u0440\u0438\u0447\u0438\u043d: \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0433\u043e\u043d\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u0418 \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435, \u043e\u043d\u043e \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b, \u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u0443\u0436\u0435 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0445\u043e\u0442\u044f, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043f\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u043d\u0430\u0437\u0430\u0434 \u0443 \u0432\u0430\u0441. \u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043b\u043e\u0433\u043e\u0432 \u0438\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442. \u0412\u0435\u0440\u043d\u0435\u0435, \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0435\u0441\u0442\u044c \u2014 \u044d\u0442\u043e UB, \u043d\u043e \u0434\u043e\u0439\u0442\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0443\u0434\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0418\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439: \u0442\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0448\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0448\u044c \u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0438 \u0432\u0441\u0451 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043b\u043e\u043c\u0430\u0442\u044c\u0441\u044f. \u0412\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u0435. \u0416\u0443\u0442\u044c. \u0418 \u0432\u0441\u0451 \u0438\u0437-\u0437\u0430 \u043f\u0430\u0440\u044b \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432 \u0432\u0430\u0441.<\/p>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b, \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439, \u0447\u0442\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043c\u044b\u0441\u043b\u044c: \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u044e\u0442 \u043e\u0431 UB, \u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u043c\u0435\u0440\u0442\u043d\u044b\u0435, \u0438 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e \u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442.<\/p>\n<p><strong>\u041f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e<\/strong><\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435 \u043a\u043d\u0438\u0433\u0443 \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0421\u0432\u0438\u0440\u0438\u0434\u043a\u0438\u043d\u0430 \u043f\u043e\u0434 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0435\u0439 \u0410\u043d\u0434\u0440\u0435\u044f \u041a\u0430\u0440\u043f\u043e\u0432\u0430 \u043f\u0440\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1129\/\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u0417\u0430\u043e\u0434\u043d\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/pvs-studio.ru\/ru\/subscribe\/\">\u0435\u0436\u0435\u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 \u0434\u0430\u0439\u0436\u0434\u0435\u0441\u0442<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043d\u0438\u0433\u0438 \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N1<\/strong><\/p>\n<p>\u0410 \u043d\u0430\u0447\u043d\u0451\u043c \u043c\u044b \u0441 \u0431\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438 \u0432 \u043c\u0438\u0440\u0435 \u043e\u0448\u0438\u0431\u043e\u043a. \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.<\/p>\n<pre><code class=\"cpp\">void LineTable::Dump(Stream *s, Target *target, Address::DumpStyle style,                      Address::DumpStyle fallback_style, bool show_line_ranges)  {   const size_t count = m_entries.size();   LineEntry line_entry;   SupportFileSP prev_file;   \/\/ &lt;=   for (size_t idx = 0; idx &lt; count; ++idx) {     ConvertEntryAtIndexToLineEntry(idx, line_entry);     line_entry.Dump(s, target, *prev_file != *line_entry.original_file_sp, \/\/ &lt;=                     style, fallback_style, show_line_ranges);     s->EOL();     prev_file = line_entry.original_file_sp;   } }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v522\/\">V522<\/a> Dereferencing of the null pointer &#8216;prev_file&#8217; might take place. LineTable.cpp <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/lldb\/source\/Symbol\/LineTable.cpp#L363\">363<\/a><\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <em>prev_file<\/em>. \u0410 \u0432\u043e\u0442 \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u044d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0442\u043e\u0447\u043d\u0435\u0435 \u0435\u0451 \u0442\u0438\u043f:<\/p>\n<pre><code class=\"cpp\">typedef std::shared_ptr&lt;lldb_private::SupportFile> SupportFileSP;<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0438 <em>std::shared_ptr<\/em> <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/memory\/shared_ptr\/shared_ptr#:~:text=1%2C2),empty%20shared_ptr.\">\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0451\u043c<\/a>. \u041d\u0443 \u0430 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0306\/\">\u0440\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<\/a> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a UB.<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u0432\u0435\u0434\u0451\u043c \u0441\u0447\u0451\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e UB.<\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 0 \u2014> 1.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N2<\/strong><\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u0434\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a. \u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u0434\u043d\u043e \u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a?<\/p>\n<pre><code class=\"cpp\">bool Sema::checkStringLiteralArgumentAttr(const AttributeCommonInfo &amp;CI,                                           const Expr *E, StringRef &amp;Str,                                           SourceLocation *ArgLocation)  {   const auto *Literal = dyn_cast&lt;StringLiteral>(E->IgnoreParenCasts());   .... }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>E<\/em> \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u042d\u0422\u041e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041d\u0435 \u0434\u043b\u044f \u0441\u043b\u0430\u0431\u043e\u043d\u0435\u0440\u0432\u043d\u044b\u0445<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<ul>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L349\">349<\/a>, <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L1801\">1801<\/a>. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L349\">349<\/a>, <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L1974\">1974<\/a>. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 1984. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 1999. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 2046. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 2381. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3188. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3355. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3376. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3423. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3529. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3543. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 4328. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 5416. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6353. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6437. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6447. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6965. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7096. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7239. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7467. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7742. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7772. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7825. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7842. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7872. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8224. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8305. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8455. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8602. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8819. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8827. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8870. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 977.  SemaDeclAttr.cpp<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u0442\u044c \u0433\u043e\u043b\u043e\u0441\u043b\u043e\u0432\u043d\u044b\u043c, \u043f\u043e\u043a\u0430\u0436\u0443 \u0432\u0430\u043c \u043c\u0435\u0441\u0442\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439.<\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435:<\/p>\n<pre><code class=\"cpp\">static void handleAssumumptionAttr(Sema &amp;S, Decl *D, const ParsedAttr &amp;AL) { \/\/ Handle the case where the attribute has a text message. StringRef Str; SourceLocation AttrStrLoc; if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, &amp;AttrStrLoc))   return; .... }<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0435:<\/p>\n<pre><code class=\"cpp\">static void handleWeakRefAttr(Sema &amp;S, Decl *D, const ParsedAttr &amp;AL) { .... if (AL.getNumArgs() &amp;&amp; S.checkStringLiteralArgumentAttr(AL, 0, Str)) .... }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f 0.<\/p>\n<blockquote>\n<p>&#171;UB \u043c\u043e\u0436\u0435\u0442 \u0443\u0431\u0438\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0442\u0451\u043d\u043a\u0430, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0433\u043e \u043d\u0435\u0442&#187;.<\/p>\n<\/blockquote>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0442\u044f\u0442 \u043c\u043e\u0433\u043b\u043e \u0443\u043c\u0435\u0440\u0435\u0442\u044c, \u0441\u0443\u0434\u044f \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439.<\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043f\u0440\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a UB? \u0422\u0430\u043a \u0432\u043e\u0442: 1 \u2014> 36.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N3<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"cpp\">struct ForceCodegenLinking {     ForceCodegenLinking() {       \/\/ We must reference the passes in such a way that compilers will not       \/\/ delete it all as dead code, even with whole program optimization,       \/\/ yet is effectively a NO-OP. As the compiler isn't smart enough       \/\/ to know that getenv() never returns -1, this will do the job.       \/\/ This is so that globals in the translation units where these functions       \/\/ are defined are forced to be initialized, populating various       \/\/ registries.       if (std::getenv(\"bar\") != (char*) -1)         return;        (void) llvm::createFastRegisterAllocator();       (void) llvm::createBasicRegisterAllocator();       (void) llvm::createGreedyRegisterAllocator();       (void) llvm::createDefaultPBQPRegisterAllocator();        (void)llvm::createBURRListDAGScheduler(nullptr,                                              llvm::CodeGenOptLevel::Default);       (void)llvm::createSourceListDAGScheduler(nullptr,                                                llvm::CodeGenOptLevel::Default);       (void)llvm::createHybridListDAGScheduler(nullptr,                                                llvm::CodeGenOptLevel::Default);       (void)llvm::createFastDAGScheduler(nullptr,                                          llvm::CodeGenOptLevel::Default);       (void)llvm::createDefaultScheduler(nullptr,                                          llvm::CodeGenOptLevel::Default);       (void)llvm::createVLIWDAGScheduler(nullptr,                                          llvm::CodeGenOptLevel::Default);     }   } ForceCodegenLinking; \/\/ Force link by creating a global definition. }<\/code><\/pre>\n<p>\u0412 \u0435\u0451 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u044f\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043d\u0435\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b (\u0438\u0445 \u0448\u0435\u0441\u0442\u044c \u0448\u0442\u0443\u043a). \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445:<\/p>\n<pre><code class=\"cpp\">ScheduleDAGSDNodes *llvm::createBURRListDAGScheduler(SelectionDAGISel *IS,                                                     CodeGenOptLevel OptLevel) {   const TargetSubtargetInfo &amp;STI = IS->MF->getSubtarget();   .... }<\/code><\/pre>\n<p>\u0418\u043b\u0438<\/p>\n<pre><code class=\"cpp\">ScheduleDAGSDNodes* createDefaultScheduler(SelectionDAGISel *IS,                                            CodeGenOpt::Level OptLevel)  {   const TargetLowering *TLI = IS->TLI;   const TargetSubtargetInfo &amp;ST = IS->MF->getSubtarget();   .... }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f <em>nullptr<\/em>. \u0410 \u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>IS<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0421\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 LLVM \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u044e\u0442 \u0438 \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c UB. \u0410 \u043c\u043e\u0436\u0435\u0442, \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043b\u044e\u0431\u044f\u0442 \u043a\u043e\u0442\u044f\u0442 \ud83d\ude00<\/p>\n<p>\u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<ul>\n<li>\n<p>V522 Dereferencing of the null pointer might take place. The null pointer is passed into &#8216;createBURRListDAGScheduler&#8217; function. Inspect the first argument. Check lines: &#8216;ScheduleDAGRRList.cpp:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/lib\/CodeGen\/SelectionDAG\/ScheduleDAGRRList.cpp#L3147\">3147&#8242;<\/a>, &#8216;LinkAllCodegenComponents.h:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/include\/llvm\/CodeGen\/LinkAllCodegenComponents.h#L40\">40&#8242;<\/a>.<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer might take place. The null pointer is passed into &#8216;createSourceListDAGScheduler&#8217; function. Inspect the first argument. Check lines: &#8216;ScheduleDAGRRList.cpp:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/lib\/CodeGen\/SelectionDAG\/ScheduleDAGRRList.cpp#L3161\">3161&#8242;<\/a>, &#8216;LinkAllCodegenComponents.h:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/include\/llvm\/CodeGen\/LinkAllCodegenComponents.h#L42\">42&#8242;<\/a>.<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer might take place. The null pointer is passed into &#8216;createHybridListDAGScheduler&#8217; function. Inspect the first argument. Check lines: &#8216;ScheduleDAGRRList.cpp:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/lib\/CodeGen\/SelectionDAG\/ScheduleDAGRRList.cpp#L3175\">3175&#8242;<\/a>, &#8216;LinkAllCodegenComponents.h:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/include\/llvm\/CodeGen\/LinkAllCodegenComponents.h#L44\">44&#8242;<\/a>.<\/p>\n<\/li>\n<li>\n<p>&#8230; (\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435)<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 36 \u2014> 42.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N4<\/strong><\/p>\n<p>\u041e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442, \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0435 UB:<\/p>\n<pre><code class=\"cpp\">Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,                                            const CallExpr *E)  {   ....   unsigned SrcNumElts =         cast&lt;llvm::FixedVectorType>(Ops[1]->getType())->getNumElements();   ....   int Indices[16];     for (unsigned i = 0; i != DstNumElts; ++i)       Indices[i] = (i >= SrcNumElts) ? SrcNumElts + (i % SrcNumElts) : i;   .... }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v609\/\">V609<\/a> Mod by zero. Denominator &#8216;SrcNumElts&#8217; == 0. CGBuiltin.cpp:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/CodeGen\/CGBuiltin.cpp#L14833\">14833<\/a><\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <em>SrcNumElts<\/em>. \u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440. \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438: <em>i<\/em> \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u0435\u043d <em>SrcNumElts<\/em>. \u0422\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 <em>SrcNumElts == 0<\/em> (\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0432\u044b\u0448\u0435 \u043d\u0430 \u044d\u0442\u043e \u043d\u0435\u0442, \u0438 <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/279a659e9772e48d95ad7d81f6deb00ee31e35e1\/llvm\/include\/llvm\/IR\/DerivedTypes.h#L582C3-L582C46\"><em>getNumElements<\/em><\/a> \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c 0), \u0443 \u043d\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <em>SrcNumElts + (i % SrcNumElts)<\/em>. \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043f\u0440\u0438 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0085\/\">\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u043d\u0430 0<\/a> (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e) \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/operator_arithmetic#Built-in_multiplicative_operators:~:text=The%20result%20of%20built%2Din%20division%20is%20lhs%20divided%20by%20rhs.%20If%20rhs%20is%20zero%2C%20the%20behavior%20is%20undefined.\">\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e<\/a>.<\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 42 \u2014> 43.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N5<\/strong><\/p>\n<p>\u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 <em>if<\/em>-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0438 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">static bool StopAtComponentPre(const Symbol &amp;component) {   if constexpr (componentKind == ComponentKind::Ordered) {     \/\/ Parent components need to be iterated upon after their     \/\/ sub-components in structure constructor analysis.     return !component.test(Symbol::Flag::ParentComp);   } else if constexpr (componentKind == ComponentKind::Direct) {     return true;   } else if constexpr (componentKind == ComponentKind::Ultimate) {     return component.has&lt;ProcEntityDetails>() ||         IsAllocatableOrObjectPointer(&amp;component) ||         (component.has&lt;ObjectEntityDetails>() &amp;&amp;             component.get&lt;ObjectEntityDetails>().type() &amp;&amp;             component.get&lt;ObjectEntityDetails>().type()->AsIntrinsic());   } else if constexpr (componentKind == ComponentKind::Potential) {     return !IsPointer(component);   } else if constexpr (componentKind == ComponentKind::PotentialAndPointer) {     return true;   } }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v591\/\">V591<\/a> Non-void function should return a value. tools.cpp:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/flang\/lib\/Semantics\/tools.cpp#L1278\">1278<\/a><\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435\u0442 <em>return<\/em> \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043b\u043e\u0436\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a enum class <em>ComponentKind<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>Scope<\/em>, \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u0434\u0435\u0441\u044c. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/return#:~:text=Flowing%20off%20the,is%20undefined%20behavior.\">\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e<\/a>.<\/p>\n<p>\u041f\u0440\u0438\u0447\u0451\u043c \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0451\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<em>true<\/em> \u0438\u043b\u0438 <em>false<\/em>). <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0917\/\">\u042d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0441\u0451 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e<\/a>.<\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 43 \u2014> 44.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N6<\/strong><\/p>\n<p>\u0412\u043e\u0442 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c:<\/p>\n<pre><code class=\"cpp\">bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(     ObjCISA isa, ObjCISA &amp;ret_isa) {   ....   if (index > m_indexed_isa_cache.size())     return false;    LLDB_LOGF(log, \"AOCRT::NPI Evaluate(ret_isa = 0x%\" PRIx64 \")\",           (uint64_t)m_indexed_isa_cache[index]);   .... }<\/code><\/pre>\n<p>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043a\u0440\u0438\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043b\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430.<\/p>\n<p>\u041d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0442\u0443\u0442 \u0438\u043c\u0435\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0437\u0432\u0451\u0437\u0434\u044b \u0441\u043e\u0439\u0434\u0443\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>index<\/em> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u0430 <em>m_indexed_isa_cache.size()<\/em>, \u0442\u043e \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043e\u043d\u043e. \u0414\u0430-\u0434\u0430, <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0071\/\">\u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/a> \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v557\/\">V557<\/a> Array overrun is possible. The &#8216;index&#8217; index is pointing beyond array bound. AppleObjCRuntimeV2.cpp <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/lldb\/source\/Plugins\/LanguageRuntime\/ObjC\/AppleObjCRuntime\/AppleObjCRuntimeV2.cpp#L3308\">3308<\/a><\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">if (index >= m_indexed_isa_cache.size())     return false;<\/code><\/pre>\n<p>\u0418 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435, \u043d\u043e \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u043f\u043e \u043a\u043e\u0434\u0443:<\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v557\/\">V557<\/a> Array overrun is possible. The &#8216;index&#8217; index is pointing beyond array bound. AppleObjCRuntimeV2.cpp <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/lldb\/source\/Plugins\/LanguageRuntime\/ObjC\/AppleObjCRuntime\/AppleObjCRuntimeV2.cpp#L3311\">3311<\/a><\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 44 \u2014> 46<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N7<\/strong><\/p>\n<p>\u041a\u0430\u043a \u0433\u043b\u0430\u0441\u0438\u0442 \u043f\u043e\u0441\u043b\u043e\u0432\u0438\u0446\u0430, &#171;\u0432\u0441\u0435\u043c\u0443 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f&#187;. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0436\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0437\u0436\u0435, \u0447\u0435\u043c \u0435\u0433\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd::     StdlibCoroutineHandleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)     : SyntheticChildrenFrontEnd(*valobj_sp) {   if (valobj_sp)     Update(); }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v664\/\">V664<\/a> 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: <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/lldb\/source\/Plugins\/Language\/CPlusPlus\/Coroutines.cpp#L99\">99<\/a>, 100. Coroutines.cpp<\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 46 \u2014> 47<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N8<\/strong><\/p>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u2014 \u043a \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044e \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f. \u0423\u0436\u0435, \u043f\u0440\u0430\u0432\u0434\u0430, \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043c\u0435\u0441\u0442\u0435.<\/p>\n<pre><code class=\"cpp\">void SetInsertPoint(Instruction *I) {   BB = I->getParent();   InsertPt = I->getIterator();   assert(InsertPt != BB->end() &amp;&amp; \"Can't read debug loc from end()\");   SetCurrentDebugLocation(I->getStableDebugLoc()); }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v522\/\">V522<\/a> Dereferencing of the null pointer &#8216;I&#8217; might take place. The null pointer is passed into &#8216;SetInsertPoint&#8217; function. Inspect the first argument. Check lines: &#8216;IRBuilder.h:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/include\/llvm\/IR\/IRBuilder.h#L188\">188&#8242;<\/a>, &#8216;OMPIRBuilder.cpp:<a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/llvm\/lib\/Frontend\/OpenMP\/OMPIRBuilder.cpp#L5983\">5983&#8242;<\/a>.<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>I<\/em>. \u0427\u0442\u043e \u0436, \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0442\u0443 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">if (UnreachableInst *ExitTI =         dyn_cast&lt;UnreachableInst>(ExitBB->getTerminator())) {   CurBBTI->eraseFromParent();   Builder.SetInsertPoint(ExitBB); } else {   Builder.SetInsertPoint(ExitTI); }<\/code><\/pre>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e. \u0421\u0443\u0434\u044f \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 (<em>ExitTI<\/em> \u0438 <em>ExitBB<\/em>) \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f (<em>getTerminator<\/em>), \u0443 \u043c\u0435\u043d\u044f \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u044e\u0442 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \ud83d\ude00 (\u0445\u043e\u0442\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c).<\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e &#171;\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0442\u043e\u0440\u0430&#187; <em>ExitTI<\/em> \u0438\u0437 <em>ExitBB->getTerminator(),<\/em> \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u0441\u0442\u0430\u043d\u0443\u0432 \u0435\u0433\u043e \u043a <em>UnreachableInst<\/em>. \u0412\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <em>if<\/em>. \u0415\u0441\u043b\u0438 \u043e\u043d \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <em>else<\/em>-\u0432\u0435\u0442\u0432\u044c, \u0433\u0434\u0435 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0442\u0443\u0442 \u0436\u0435 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0410\u0441\u0442\u0430 \u043b\u0430 \u0432\u0438\u0441\u0442\u0430, \u0431\u0435\u0439\u0431\u0438.<\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 47 \u2014> 48<\/p>\n<p><strong>\u041f\u043e\u0441\u043b\u0435\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u0440\u043e \u0440\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<\/strong><\/p>\n<p>\u0422\u0435\u043c\u0430 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0442\u0430\u043a \u0436\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0430, \u043a\u0430\u043a \u043a\u0440\u043e\u043b\u0438\u0447\u044c\u044f \u043d\u043e\u0440\u0430. \u0418\u043b\u0438 \u0435\u0449\u0451 \u0433\u043b\u0443\u0431\u0436\u0435. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0440\u0430\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0435\u0431\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u043c \u043f\u0440\u043e *(char*)0 = 0;<\/p>\n<p><a href=\"https:\/\/www.youtube.com\/watch?v=dFIqNZ8VbRY&amp;ab_channel=cpponsea\">https:\/\/www.youtube.com\/watch?v=dFIqNZ8VbRY&amp;ab_channel=cpponsea<\/a><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u0447\u0435\u0433\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 &#171;<a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/1120\/\">\u041f\u043e\u0434\u0431\u043e\u0440\u043a\u0430 \u043a\u0440\u0443\u0442\u044b\u0445 \u0434\u043e\u043a\u043b\u0430\u0434\u043e\u0432 \u043f\u043e \u0421++ \u0437\u0430 2023 \u0433\u043e\u0434<\/a>&#171;.<\/p>\n<p><strong>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 48, \u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a \u043a\u043e\u043d\u0446\u0443.<\/p>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435, \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0438 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u0415\u0449\u0451 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0447\u0442\u043e \u0438\u0445 \u043d\u0435 \u043d\u0430\u0448\u043b\u0438 \u0441\u0440\u0430\u0437\u0443, \u043a\u043e\u0433\u0434\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434. \u0412\u0435\u0434\u044c \u043e\u0431\u044b\u0447\u043d\u043e UB \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u043c\u0435\u043d\u0435\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0435\u0433\u043e \u0435\u0449\u0451 \u0442\u0440\u0443\u0434\u043d\u0435\u0435.<\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a UB \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u2014 \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0443\u0441\u0438\u043b\u0438\u0439. \u0414\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0435 \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0433\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430.<\/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: Alexey Smolskas. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/1130\/\">How much UB is in my compiler?<\/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\/820983\/\"> https:\/\/habr.com\/ru\/articles\/820983\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0423 C \u0438 C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0434\u0432\u0435 \u0433\u043e\u043b\u043e\u0432\u043d\u044b\u0435 \u0431\u043e\u043b\u0438 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043e\u0448\u0438\u0431\u043e\u043a: \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0418 \u043a\u0430\u043a \u0432\u044b \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0451\u0442 \u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438. \u0418 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e &#171;\u043c\u043e\u0451\u043c&#187; \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435. \u0415\u0441\u043b\u0438 \u0442\u043e\u0447\u043d\u0435\u0435, \u0442\u043e \u043e \u043d\u0430\u0431\u043e\u0440\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0434\u043b\u044f \u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e LLVM. \u041f\u043e\u0447\u0435\u043c\u0443 &#171;\u043c\u043e\u0451\u043c&#187;? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u0438\u043c Clang, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 LLVM, \u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0438\u043c \u043d\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438 \u043a\u043e\u0434 LLVM \u0438 \u0434\u0430\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1126\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>. \u042d\u0442\u043e \u0435\u0451 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c.<\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/strong><\/p>\n<p>\u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 Undefined Behavior (UB) \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u044f\u0437\u044b\u043a\u0430, \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0410 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0412\u0435\u0434\u044c UB \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u043e \u0442\u0432\u043e\u0435\u043c\u0443 \u043a\u043e\u0434\u0443.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0432\u0441\u0451 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u041f\u043e\u0440\u043e\u0439 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u0438 \u0445\u043e\u0442\u0435\u043b\u0438. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043c\u0435\u043b\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0438 \u0432\u0430\u043c \u043f\u043e\u0432\u0435\u0437\u043b\u043e.<\/p>\n<p>UB \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0438\u0437-\u0437\u0430 \u0446\u0435\u043b\u043e\u0433\u043e \u0440\u044f\u0434\u0430 \u043f\u0440\u0438\u0447\u0438\u043d: \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0433\u043e\u043d\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e. \u0418 \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435, \u043e\u043d\u043e \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u044b, \u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u0443\u0436\u0435 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0445\u043e\u0442\u044f, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043f\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u043d\u0430\u0437\u0430\u0434 \u0443 \u0432\u0430\u0441. \u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043b\u043e\u0433\u043e\u0432 \u0438\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442. \u0412\u0435\u0440\u043d\u0435\u0435, \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0435\u0441\u0442\u044c \u2014 \u044d\u0442\u043e UB, \u043d\u043e \u0434\u043e\u0439\u0442\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0443\u0434\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0418\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439: \u0442\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0448\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0448\u044c \u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0438 \u0432\u0441\u0451 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043b\u043e\u043c\u0430\u0442\u044c\u0441\u044f. \u0412\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u0435. \u0416\u0443\u0442\u044c. \u0418 \u0432\u0441\u0451 \u0438\u0437-\u0437\u0430 \u043f\u0430\u0440\u044b \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432 \u0432\u0430\u0441.<\/p>\n<p>\u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b, \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u0439, \u0447\u0442\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u043c\u044b\u0441\u043b\u044c: \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u044e\u0442 \u043e\u0431 UB, \u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u043c\u0435\u0440\u0442\u043d\u044b\u0435, \u0438 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u043d\u043e \u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442.<\/p>\n<p><strong>\u041f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e<\/strong><\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435 \u043a\u043d\u0438\u0433\u0443 \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0421\u0432\u0438\u0440\u0438\u0434\u043a\u0438\u043d\u0430 \u043f\u043e\u0434 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0435\u0439 \u0410\u043d\u0434\u0440\u0435\u044f \u041a\u0430\u0440\u043f\u043e\u0432\u0430 \u043f\u0440\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1129\/\">\u0421\u0441\u044b\u043b\u043a\u0430<\/a> \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u0417\u0430\u043e\u0434\u043d\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/pvs-studio.ru\/ru\/subscribe\/\">\u0435\u0436\u0435\u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 \u0434\u0430\u0439\u0436\u0434\u0435\u0441\u0442<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043d\u0438\u0433\u0438 \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N1<\/strong><\/p>\n<p>\u0410 \u043d\u0430\u0447\u043d\u0451\u043c \u043c\u044b \u0441 \u0431\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438 \u0432 \u043c\u0438\u0440\u0435 \u043e\u0448\u0438\u0431\u043e\u043a. \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.<\/p>\n<pre><code class=\"cpp\">void LineTable::Dump(Stream *s, Target *target, Address::DumpStyle style,                      Address::DumpStyle fallback_style, bool show_line_ranges)  {   const size_t count = m_entries.size();   LineEntry line_entry;   SupportFileSP prev_file;   \/\/ &lt;=   for (size_t idx = 0; idx &lt; count; ++idx) {     ConvertEntryAtIndexToLineEntry(idx, line_entry);     line_entry.Dump(s, target, *prev_file != *line_entry.original_file_sp, \/\/ &lt;=                     style, fallback_style, show_line_ranges);     s->EOL();     prev_file = line_entry.original_file_sp;   } }<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v522\/\">V522<\/a> Dereferencing of the null pointer &#8216;prev_file&#8217; might take place. LineTable.cpp <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/lldb\/source\/Symbol\/LineTable.cpp#L363\">363<\/a><\/p>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <em>prev_file<\/em>. \u0410 \u0432\u043e\u0442 \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u044d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0442\u043e\u0447\u043d\u0435\u0435 \u0435\u0451 \u0442\u0438\u043f:<\/p>\n<pre><code class=\"cpp\">typedef std::shared_ptr&lt;lldb_private::SupportFile> SupportFileSP;<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0438 <em>std::shared_ptr<\/em> <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/memory\/shared_ptr\/shared_ptr#:~:text=1%2C2),empty%20shared_ptr.\">\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0451\u043c<\/a>. \u041d\u0443 \u0430 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0306\/\">\u0440\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<\/a> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a UB.<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u0432\u0435\u0434\u0451\u043c \u0441\u0447\u0451\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e UB.<\/p>\n<p>\u0421\u0447\u0451\u0442\u0447\u0438\u043a UB: 0 \u2014> 1.<\/p>\n<p><strong>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 N2<\/strong><\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u0434\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a. \u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u0434\u043d\u043e \u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a?<\/p>\n<pre><code class=\"cpp\">bool Sema::checkStringLiteralArgumentAttr(const AttributeCommonInfo &amp;CI,                                           const Expr *E, StringRef &amp;Str,                                           SourceLocation *ArgLocation)  {   const auto *Literal = dyn_cast&lt;StringLiteral>(E->IgnoreParenCasts());   .... }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <em>E<\/em> \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u042d\u0422\u041e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041d\u0435 \u0434\u043b\u044f \u0441\u043b\u0430\u0431\u043e\u043d\u0435\u0440\u0432\u043d\u044b\u0445<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:<\/p>\n<ul>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L349\">349<\/a>, <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L1801\">1801<\/a>. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L349\">349<\/a>, <a href=\"https:\/\/github.com\/llvm\/llvm-project\/blob\/461274b81d8641eab64d494accddc81d7db8a09e\/clang\/lib\/Sema\/SemaDeclAttr.cpp#L1974\">1974<\/a>. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 1984. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 1999. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 2046. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 2381. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3188. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3355. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3376. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3423. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3529. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 3543. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 4328. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 5416. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6353. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6437. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6447. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 6965. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7096. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7239. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7467. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7742. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7772. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7825. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7842. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 7872. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8224. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522 Dereferencing of the null pointer &#8216;E&#8217; might take place. The null pointer is passed into &#8216;checkStringLiteralArgumentAttr&#8217; function. Inspect the second argument. Check lines: 349, 8305. SemaDeclAttr.cpp<\/p>\n<\/li>\n<li>\n<p>V522<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-378603","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/378603","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=378603"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/378603\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=378603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=378603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=378603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}