https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107846
Bug ID: 107846
Summary: error: result of '8000 << 8' requires 22 bits to
represent, but 'short int' only has 16 bits
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: james.hilliard1 at gmail dot com
Target Milestone: ---
I'm seeing this error which does not occur in llvm for a bpf
test(test_tc_tunnel.c) in bpf-next, I'm not sure if this is an upstream bug in
the test itself or a bug in gcc:
In function '__encap_ipv4':
cc1: error: result of '8000 << 8' requires 22 bits to represent, but 'short
int' only has 16 bits [-Werror=shift-overflow=]
cc1: error: result of '20000 << 8' requires 24 bits to represent, but 'short
int' only has 16 bits [-Werror=shift-overflow=]
progs/test_tc_tunnel.c:228:31: warning: taking address of packed member of
'struct v4hdr' may result in an unaligned pointer value
[-Waddress-of-packed-member]
228 | set_ipv4_csum((void *)&h_outer.ip);
| ^~~~~~~~~~~
In function '__encap_ipv6':
cc1: error: result of '8000 << 8' requires 22 bits to represent, but 'short
int' only has 16 bits [-Werror=shift-overflow=]
cc1: error: result of '20000 << 8' requires 24 bits to represent, but 'short
int' only has 16 bits [-Werror=shift-overflow=]