-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Description
Clang misses a shift count warning found by GCC.
cat shift.c#include <stdio.h>
typedef enum shiftof {
OFA_FM_POL_ERROR = (1<<32)
} shiftof_t;
int main()
{
printf ("%u %lu %lu\n", OFA_FM_POL_ERROR, sizeof(OFA_FM_POL_ERROR), sizeof(shiftof_t));
}$ ./bin/clang -Wall shift.c
(no warning)
$ gcc -Wall shift.c
shift.c:3:26: warning: left shift count >= width of type [-Wshift-count-overflow]
OFA_FM_POL_ERROR = (1<<32)
^~
$ gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10)
$ ./bin/clang --version
clang version 16.0.0 (https://github.com/llvm/llvm-project 6daa983c9dde7608bcaa20b11e4a7d28fab4e003)Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer