[llvm-bugs] [Bug 47073] New: In the for-range statement, erase() should not be used to remove the elements which the loop iterates over.(Potential defects)(llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:line 59 and line 771)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 9 20:29:14 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47073

            Bug ID: 47073
           Summary: In the for-range statement, erase() should not be used
                    to remove the elements which the loop iterates
                    over.(Potential
                    defects)(llvm-project/llvm/utils/TableGen/CodeGenDAGPa
                    tterns.cpp:line 59 and line 771)
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Object
          Assignee: unassignedbugs at nondot.org
          Reporter: info at ustchcs.com
                CC: llvm-bugs at lists.llvm.org

In the for-range statement, erase() should not be used to remove the elements
which the loop iterates over.(Potential defects)

commit e3546c78cabfbf670391a57766872f0a8e28a423

llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:line 59 

    55    for (MVT T : S) {
    56      if (!P(T))
    57        continue;
    58      Erased = true;
    59      S.erase(T);
    60    }
    61    return Erased;
    62  }

llvm-project/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:line 771

   764    std::set<MVT> Ovs;
   765    for (MVT T : Out) {
   766      if (!T.isOverloaded())
   767        continue;
   768  
   769      Ovs.insert(T);
   770      // MachineValueTypeSet allows iteration and erasing.
   771      Out.erase(T);
   772    }

Reported by: Ustchcs Toolsets Bugfinder
(bugfinder-13.15: In the for-range statement, erase() should not be used to
remove the elements which the loop iterates over.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200810/d8f306f8/attachment.html>


More information about the llvm-bugs mailing list