arocc icon indicating copy to clipboard operation
arocc copied to clipboard

Missing warnings for negative and too big shift count

Open Vexu opened this issue 2 years ago • 2 comments

$ clang a.c -c
a.c:1:14: warning: shift count is negative [-Wshift-count-negative]
int a = 0b11 << -32;
             ^  ~~~
a.c:2:14: warning: shift count >= width of type [-Wshift-count-overflow]
int b = 0b11 << 32;
             ^  ~~
2 warnings generated.

Vexu avatar Dec 04 '23 17:12 Vexu

Should this be implemented in Parser.zig?

sno2 avatar Dec 29 '23 06:12 sno2

Yes but you can also change the shift functions in Value.zig.

Vexu avatar Dec 30 '23 12:12 Vexu