Skip to content

Portability: Arithmetic on void pointers #9879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mped-oticon opened this issue Sep 10, 2018 · 3 comments
Closed

Portability: Arithmetic on void pointers #9879

mped-oticon opened this issue Sep 10, 2018 · 3 comments
Assignees
Labels
area: Portability Standard compliant code, toolchain abstraction area: Toolchains Toolchains bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@mped-oticon
Copy link
Collaborator

Hi,

One use of GCC extensions we are patching-away is the use of arithmetic on void pointers [1].
PR will follow soon, but this issue is raised to also discourage future use of this extension.

Arithmetics on void pointers are used in bluetooth/gatt.h and mempool.

We patch this as our clang-based compiler only supports standard C99, C11.
Note that our compiler is provided by one of the major EDA vendors. While this is a trivial issue, it affects portabillity and patching incurs legal issues with respect to Certification, FDA, etc.

Best regards,
Mark

[1] https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

@mped-oticon mped-oticon self-assigned this Sep 10, 2018
@mped-oticon mped-oticon added Waiting for response Waiting for author's response priority: low Low impact/importance bug area: Toolchains Toolchains area: Portability Standard compliant code, toolchain abstraction labels Sep 10, 2018
@jhedberg jhedberg assigned Vudentz and mped-oticon and unassigned mped-oticon Sep 11, 2018
@jhedberg
Copy link
Member

Could you clarify where in gatt.h you see this happening?

@mped-oticon
Copy link
Collaborator Author

@jhedberg Sorry, I meant gatt.c:

ssize_t bt_gatt_attr_read( .... u16_t offset, const void *value,  ....) {
  memcpy(buf, value + offset, len);

I will soon submit a PR.

@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Sep 13, 2018
@mped-oticon
Copy link
Collaborator Author

Fixed as of PR #9917. Also added warning flag to prevent this from occurring in future.

@mped-oticon mped-oticon removed the Waiting for response Waiting for author's response label Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Portability Standard compliant code, toolchain abstraction area: Toolchains Toolchains bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants