[llvm-bugs] [Bug 41641] New: Warnings do not consider __builtin_assume

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 28 11:12:20 PDT 2019


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

            Bug ID: 41641
           Summary: Warnings do not consider __builtin_assume
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

The following code emits: <source>:9:1: warning: control may reach end of
non-void function [-Wreturn-type]



int f(unsigned x) {
    __builtin_assume(x <= 1);
    switch (x) {
        case 0:
            return 0;
        case 1:
            return 1;
    }
}


https://godbolt.org/z/rJGpzJ


I'm not sure how feasible fixing this would be, but I would like to be able to
have behavior similar to switching over an enum when I know the range of the
integer is limited.

-- 
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/20190428/e0659423/attachment.html>


More information about the llvm-bugs mailing list