Opened 6 years ago
Closed 6 years ago
#118 closed defect (fixed)
Incorrect bit shift warning
Reported by: | Thierry Delisle | Owned by: | a3moss |
---|---|---|---|
Priority: | major | Component: | cfa-cc |
Version: | 1.0 | Keywords: | |
Cc: |
Description (last modified by )
The following code:
extern "C" { #include <sys/sysmacros.h> } int main() { return 0; }
produces the following warning
/usr/include/x86_64-linux-gnu/sys/sysmacros.h: In function ‘gnu_dev_major’: /usr/include/x86_64-linux-gnu/sys/sysmacros.h:41:145: warning: right shift count >= width of type [-Wshift-count-overflow] return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
Command used :
cfa-1.0 test.cfa -Wall -Wextra -O2
Change History (4)
comment:1 Changed 6 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 6 years ago by
Shorter test case:
int main() { unsigned long long dev = 0; unsigned ret = (unsigned)(dev >> 32); }
Version 0, edited 6 years ago
by
(next)
comment:4 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Backed out change to CastExpr
resolution that changed cast costs; concurrently removed specialization cost from return types in new cost model.
Note: See
TracTickets for help on using
tickets.
Under
-O2
the preprocessor generates a body forgnu_dev_major
that it does not generate at-O0
.