https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112296

--- Comment #9 from Richard Henderson <rth at gcc dot gnu.org> ---
> Thanks.  So yes,
> 
> macro(x++);
> 
> incrementing x twice would have been odd - but that's the usual bug
> in this kind of macro definition.  Fixing it by throwing away
> side-effects (and always going the out_of_line_function (x) path!)
> for the __builtin_constant_p argument is an odd choice.

In the beginning __builtin_constant_p was resolved immediately,
so formulating this as

#define macro(x) \
  ({ __typeof(x) _x = (x); \
     __builtin_constant_p(_x) })

would always return false, defeating the purpose.

> The execute.exp testcase suggests the intention but the testcases
> verification is somewhat incomplete (it lacks verifying the side-effects
> are gone).

That's probably my omission.  ;-)

Reply via email to