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: unassignedclangb...@nondot.org
          Reporter: da...@doublewise.net
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to