llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Clang misses -Wsign-conversion warning in a simple code

Open haoxintu opened this issue 6 years ago • 0 comments

Bugzilla Link 46171
Version trunk
OS All
CC @dwblaikie,@DougGregor,@zygoloid

Extended Description

$cat test.cc int main(){ int a = 1; int array[a]; return 0;
}

in GCC

$g++ -Wsign-conversion test.cc : In function 'int main()': :3:15: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion] 3 | int array[a]; |

But there is no warnings in clang-trunk.

https://godbolt.org/z/xCQiuT

haoxintu avatar Jun 02 '20 10:06 haoxintu