[llvm-bugs] [Bug 41556] New: Bogus warning: all paths through this function will call itself

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 22 01:59:10 PDT 2019


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

            Bug ID: 41556
           Summary: Bogus warning: all paths through this function will
                    call itself
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yuri at tsoft.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 21807
  --> https://bugs.llvm.org/attachment.cgi?id=21807&action=edit
infinite-recursion-testcase.cpp

It prints this bogus warning:
> $ c++ -Wall -o infinite-recursion-testcase infinite-recursion-testcase.cpp
> infinite-recursion-testcase.cpp:9:87: warning: all paths through this function will call itself [-Winfinite-recursion]
>     friend std::ostream& operator<<(std::ostream &os, const AtomSignature &signature) {
>                                                                                       ^
> 1 warning generated.


The warning is bogus because it calls itself with a different object. There is
no problem with infinite recursion there.
As long as there is variability in any of the arguments - there is no problem
with infinite recursion.

-- 
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/20190422/18681e37/attachment.html>


More information about the llvm-bugs mailing list