[llvm-bugs] [Bug 39938] New: Warning inconsistently reported on dead code

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 10 11:22:00 PST 2018


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

            Bug ID: 39938
           Summary: Warning inconsistently reported on dead code
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: serge.guelton at telecom-bretagne.eu
                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

When compiled with -Wall, the following code reports a warning only on the live
path, as showcased in https://godbolt.org/z/3PD-eF

int case0(int num) {
    if(0)
        return num / 0; << no warning
    else
        return 1;
}
int case1(int num) {
    if(num)
        return num / 0; << warning
    else
        return 1;
}


Yet, when the following code is compiled with -Wall -Wdouble-conversion, we
have a warning even in the dead path, as showcased in
https://godbolt.org/z/58Q5oA


double foo(double);

int case0(float num) {
    if(0)
        return foo(num); << warning
    else
        return 1;
}
int case1(float num) {
    if(num)
        return foo(num); << warning
    else
        return 1;
}

-- 
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/20181210/3a40b923/attachment-0001.html>


More information about the llvm-bugs mailing list