# clang: \-fno-sanitize=function workaround · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/66312c0b51c43feb40892c8873f018619b8d3fed)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 66312c0b51c43feb40892c8873f018619b8d3fed

Requested commit: 66312c0b51c43feb40892c8873f018619b8d3fed

Commit: 66312c0b51c43feb40892c8873f018619b8d3fed

Tree: 1cf3d8471fe141ed4dabf3a4c260941b1d67ee5c

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
clang: -fno-sanitize=function workaround

It is very common, and well-defined, for a pointer on one side of a C ABI
to have a different but compatible element type. Examples include:

- `char*` vs `uint8_t*` on a system with 8-bit bytes
- `const char*` vs `char*`
- `char*` vs `unsigned char*`

Without this flag, Clang would invoke UBSAN when such an extern
function was called.

Might be nice to file an upstream issue and find out if there is a more
precise way to disable the problematic check.
`-fsanitize-cfi-icall-generalize-pointers` looks promising according to
the documentation, but empirically it does not work.

```

## Parents

- [75b8b21cc1db3413578b5b42a39a40fb8b140da4](https://git.cafe/gitcafe/zig/commit/75b8b21cc1db3413578b5b42a39a40fb8b140da4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/66312c0b51c43feb40892c8873f018619b8d3fed?format=markdown)
