https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6906
felix <felix.von.s at posteo dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |felix.von.s at posteo dot de --- Comment #9 from felix <felix.von.s at posteo dot de> --- I have just realised that __builtin_pure_p is already expressible: #define __builtin_pure_p(expr) \ (__builtin_object_size(((void)(expr), ""), 2)) If (expr) is free of side effects, this is the same as __builtin_object_size("", 2), which is 1. Otherwise, the expression returns 0. This is documented behaviour, by the way. The documentation for __builtin_object_size at <https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html> states: > __builtin_object_size never evaluates its arguments for side effects. > If there are any side effects in them, it returns (size_t) -1 for > type 0 or 1 and (size_t) 0 for type 2 or 3. Experimentation reveals __attribute__((pure)) is enough for __builtin_object_size to consider a function free of side effects.