Opened 7 years ago
Closed 7 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 by , 7 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 7 years ago
Shorter test case (works on O0 as well):
int main() {
unsigned long long dev = 0;
unsigned ret = (unsigned)(dev >> 32);
}
comment:4 by , 7 years ago
| 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
-O2the preprocessor generates a body forgnu_dev_majorthat it does not generate at-O0.