[llvm-bugs] [Bug 40375] New: AttributedStatement not correctly handled with -Wunreachable-code

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 18 10:27:37 PST 2019


            Bug ID: 40375
           Summary: AttributedStatement not correctly handled with
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kpreisert at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code produces an unreachable code warning that is attached to the
attribute (which doesn't make sense):

int f1() {
    return 1;

    return 2;

The warning is as follows (Compiler Explorer: https://godbolt.org/z/S7eOSM):

<source>:3:5: warning: code will never be executed [-Wunreachable-code]

I would expect a warning to be attached to the "return 2;" statement.

I think there's a bug in the handling of AttributedStatements (which are not
used very often so far).

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/20190118/6575d10d/attachment.html>

More information about the llvm-bugs mailing list