llvm/llvm-project

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

Open

#122 937 ouverte le 14 janv. 2025

Voir sur GitHub
 (8 commentaires) (0 réactions) (2 assignés)C++ (10 782 forks)batch import
code-qualitygood first issuellvm:codegen

Métriques du dépôt

Stars
 (26 378 stars)
Métriques de merge PR
 (Merge moyen 1j 2h) (1 000 PRs mergées en 30 j)

Description

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.

Guide contributeur