iovisor / iovisor/bcc

error when accessing flexible array member

Open
#858 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Hi, when I try to access a flexible array member of a struct the following code is generated:
```
int x = ({ typeof(struct ceph_osd_req_op []) _val; memset(&_val, 0, sizeof(_val)); bpf_probe_read(...
```
which fails to compile because `typeof(struct ceph_osd_req_op []) _val;` is not valid C code.

If I'm not mistaken the following code should be produced:
```
int x = ({ typeof(struct ceph_osd_req_op *) _val; memset(&_val, 0, sizeof(_val)); bpf_probe_read(...
```
by this function: https://github.com/iovisor/bcc/blob/21dd7b46fd21eed5e0aae709a3677bc31e9817e1/src/cc/frontends/clang/b_frontend_action.cc#L248
Is this correct? If so, I could prepare a pull request.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.