https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107846
--- Comment #1 from David Faust <david.faust at oracle dot com> --- I think this is a bug in the test itself (or with these macros from libbpf). libbpf/src/bpf_endian.h #define ___bpf_mvb(x, b, n, m) ((__u##b)(x) << (b-(n+1)*8) >> (b-8) << (m*8)) #define ___bpf_swab16(x) ((__u16)( \ ___bpf_mvb(x, 16, 0, 1) | \ ___bpf_mvb(x, 16, 1, 0))) # define __bpf_constant_htons(x) ___bpf_swab16(x) In tools/testing/selftests/bpf/progs/test_tc_tunnel.c: static const int cfg_port = 8000; static const int cfg_udp_src = 20000; ... then at e.g. line 276 if (tcph.dest != __bpf_constant_htons(cfg_port)) return TC_ACT_OK; Expanding this __bpf_constant_htons macro: __bpf_constant_htons (cfg_port) __bpf_constant_htons (8000) ((__u16)(8000) << (16-(0+1)*8) >> (16-8) << (1*8) ((__u16)(8000) << (16-(1)*8) >> (8) << 8) ((__u16)(8000) << (8) >> 8 << 8 ((__u16)(8000) << 8) ...which raises the shift-overflow warning.