http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60689
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #32469|0 |1 is obsolete| | --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 32470 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32470&action=edit gcc49-pr60689.patch Ugh, except it doesn't work, it breaks C. The problem is that add_atomic_size_parameter calls build_function_call_vec which behaves differently between C and C++. For C that function calls resolve_overloaded_builtin, thus it recurses and adds the needed parameter in there and if we add the extra parameter as in my earlier patch, the recursive resolve_overloaded_builtin will complain that __atomic_exchange has too many parameters. For C++ it doesn't call that (finish_call_expr calls that instead), thus if we don't add the parameter there, nothing adds it. So, the options I see are: 1) what I'm attaching, make build_function_call_vec which is in C++ FE only called from c-common/ bits behave like C build_function_call_vec and call resolve_overloaded_builtin there 2) some static flag which will do nothing in resolve_overloaded_builtin if called recursively (but, David Malcolm will complain about global state) 3) when checking number of arguments, allow the case when there is the extra integer argument for the size; the problem with that is that I'd be afraid we'd allow people that way to call __atomic_exchange (9, ptr1, ptr2, ptr3, __ATOMIC_SEQ_CST); which we don't want to