[PATCH] D148827: -fsanitize=function: support C

Mike Hommey via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 14 14:17:55 PDT 2023


glandium added a comment.

OTOH. 6.2.7.3:

> A composite type can be constructed from two types that are compatible; it is a type that is compatible with both of the two types (...)

6.2.7.5:

> EXAMPLE Given the following two file scope declarations:
> int f(int (*)(), double (*)[3]);
> int f(int (*)(char *), double (*)[]);
> The resulting composite type for the function is:
> int f(int (*)(char *), double (*)[3]);

This suggests that `int(*)()` and `int(*)(char*)` are compatible.

6.2.7.2:

> All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined.

6.3.2.3.1:

> A pointer to void may be converted to or from a pointer to any object type. A pointer to any object type may be converted to a pointer to void and back again; the result shall compare equal to the original pointer.

These are either contradicting, making 6.3.2.3.1 UB, or void* is compatible with other pointer types.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148827/new/

https://reviews.llvm.org/D148827



More information about the cfe-commits mailing list