llvm/llvm-project
在 GitHub 查看llvm/lib/CodeGen/LiveRangeUtils.h:40: Iterators applied to wrong data structure ?
Open
#122,937 创建于 2025年1月14日
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.