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

            Bug ID: 42058
           Summary: missing warning diagnosis of implicit conversion from
                    'double' to 'float'
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: tangyix...@mail.dlut.edu.cn
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

For the following example, clang 6.0 misses the warning diagnosis of implicit
conversion from 'double' to 'float'. 

$ cat s.c
int main(){
        double w[2]={1.0,2.0},z[2]={2.0,4.0};
        float b[2];
        for(int j=1;j<2;j++){
                b[j]+=z[j]/w[j];
        }       
        return 0;
}
$ clang --version
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang -Wconversion s.c
No warning generated.

Under the same workstation:
$ clang-7.0 -Wconversion s.c
s.c:5:13: warning: implicit conversion when assigning computation result loses
floating-point precision: 'double' to 'float' [-Wconversion]
                b[j]+=z[j]/w[j];
                    ~~~~~^~~~~
1 warning generated.

$ clang-8.0 -Wimplicit-float-conversion s.c
s.c:5:13: warning: implicit conversion when assigning computation result loses
floating-point precision: 'double' to 'float' [-Wimplicit-float-conversion]
                b[j]+=z[j]/w[j];
                    ~~~~~^~~~~
1 warning generated.

-- 
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