[Bug target/107843] New: error: incompatible type for argument in ___bpf_ctx_cast2

james.hilliard1 at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 23 17:37:33 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107843

            Bug ID: 107843
           Summary: error: incompatible type for argument in
                    ___bpf_ctx_cast2
           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(bpf_cubic.c)
in bpf-next:

In file included from
/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_tcp_helpers.h:9,
                 from progs/bpf_cubic.c:20:
progs/bpf_cubic.c: In function 'bpf_cubic_cwnd_event':
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_tracing.h:399:63:
error: incompatible type for argument 3 of '____bpf_cubic_cwnd_event'
  399 | #define ___bpf_ctx_cast2(x, args...)  ___bpf_ctx_cast1(args), (void
*)ctx[1]
      |                                                              
^~~~~~~~~~~~~~
      |                                                               |
      |                                                               void *
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_helpers.h:187:29:
note: in expansion of macro '___bpf_ctx_cast2'
  187 | #define ___bpf_concat(a, b) a ## b
      |                             ^
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_helpers.h:190:29:
note: in expansion of macro '___bpf_concat'
  190 | #define ___bpf_apply(fn, n) ___bpf_concat(fn, n)
      |                             ^~~~~~~~~~~~~
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_tracing.h:410:39:
note: in expansion of macro '___bpf_apply'
  410 | #define ___bpf_ctx_cast(args...)      ___bpf_apply(___bpf_ctx_cast,
___bpf_narg(args))(args)
      |                                       ^~~~~~~~~~~~
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_tracing.h:435:27:
note: in expansion of macro '___bpf_ctx_cast'
  435 |         return ____##name(___bpf_ctx_cast(args));                      
    \
      |                           ^~~~~~~~~~~~~~~
progs/bpf_cubic.c:189:6: note: in expansion of macro 'BPF_PROG'
  189 | void BPF_PROG(bpf_cubic_cwnd_event, struct sock *sk, enum tcp_ca_event
event)
      |      ^~~~~~~~
progs/bpf_cubic.c:189:72: note: expected 'enum tcp_ca_event' but argument is of
type 'void *'
  189 | void BPF_PROG(bpf_cubic_cwnd_event, struct sock *sk, enum tcp_ca_event
event)
      |                                                     
~~~~~~~~~~~~~~~~~~^~~~~
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_tracing.h:430:39:
note: in definition of macro 'BPF_PROG'
  430 | ____##name(unsigned long long *ctx, ##args);                           
    \
      |                                       ^~~~
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_tracing.h:435:16:
error: 'return' with a value, in function returning void [-Werror]
  435 |         return ____##name(___bpf_ctx_cast(args));                      
    \
      |                ^~~~
progs/bpf_cubic.c:189:6: note: in expansion of macro 'BPF_PROG'
  189 | void BPF_PROG(bpf_cubic_cwnd_event, struct sock *sk, enum tcp_ca_event
event)
      |      ^~~~~~~~
progs/bpf_cubic.c:189:15: note: declared here
  189 | void BPF_PROG(bpf_cubic_cwnd_event, struct sock *sk, enum tcp_ca_event
event)
      |               ^~~~~~~~~~~~~~~~~~~~
/home/buildroot/bpf-next/tools/bpf/resolve_btfids/libbpf/include/bpf/bpf_tracing.h:431:17:
note: in definition of macro 'BPF_PROG'
  431 | typeof(name(0)) name(unsigned long long *ctx)                          
    \
      |


More information about the Gcc-bugs mailing list