llvm/llvm-project

llvm/lib/CodeGen/LiveRangeUtils.h:40: Iterators applied to wrong data structure ?

Open

#122,937 建立於 2025年1月14日

在 GitHub 查看
 (8 留言) (0 反應) (2 負責人)C++ (10,782 fork)batch import
code-qualitygood first issuellvm:codegen

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

Static analyser cppcheck says:

llvm/lib/CodeGen/LiveRangeUtils.h:40:6: error: Same iterator is used with different containers 'LR' and 'LR.segments'. [iterators1]

Source code is

typename LiveRangeT::iterator J = LR.begin(), E = LR.end(); // ... LR.segments.erase(J, E);

So J and E are iterators for LR, but get used on LR.segments.

I am surprised this compiles.

貢獻者指南