[llvm-bugs] [Bug 26436] New: End of non-void function reached behavior

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 2 04:55:55 PST 2016


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

            Bug ID: 26436
           Summary: End of non-void function reached behavior
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: krejzi at email.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

When there's no return outside of conditional/loop/switch statement, but a
function expects a return type, clang will generate a warning, as expected.

There is one special case, and that's a switch statement where one statement
will always be true because every possible input value has been covered. In
such case, clang shouldn't return a warning, much like gcc does at the moment.

An example for such code can be found at [1]. See also [2].

[1]
https://github.com/systemd/systemd/blob/61f32bff6130a44d077886d38cff89ad161bf177/src/resolve/dns-type.c#L242
[2] https://github.com/systemd/systemd/issues/2504

Linux, clang 3.8.0rc1.

-- 
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/20160202/0956ce1c/attachment.html>


More information about the llvm-bugs mailing list