Bug 107847 - error: integer overflow in expression in bpf-next test_xdp_vlan.c
Summary: error: integer overflow in expression in bpf-next test_xdp_vlan.c
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-23 17:50 UTC by James Hilliard
Modified: 2022-11-23 17:51 UTC (History)
3 users (show)

See Also:
Host:
Target: bpf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Hilliard 2022-11-23 17:50:53 UTC
I'm seeing this error which does not occur in llvm for a bpf test(test_xdp_vlan.c) in bpf-next, I'm not sure if this is an upstream bug in the test itself or a bug in gcc:

progs/test_xdp_vlan.c: In function 'xdp_prognum1':
progs/test_xdp_vlan.c:163:25: error: integer overflow in expression '(short int)(((__builtin_constant_p((int)vlan_hdr->h_vlan_TCI)) != 0 ? (int)(short unsigned int)((short int)((int)vlan_hdr->h_vlan_TCI << 8 >> 8) << 8 | (short int)((int)vlan_hdr->h_vlan_TCI << 0 >> 8 << 0)) & 61440 : (int)__builtin_bswap16(vlan_hdr->h_vlan_TCI) & 61440) << 8 >> 8) << 8' of type 'short int' results in '0' [-Werror=overflow]
  163 |                         bpf_htons((bpf_ntohs(vlan_hdr->h_vlan_TCI) & 0xf000)
      |                         ^~~~~~~~~