https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41639
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |sh*-*
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So I looked into the history here and the code was correct even when this bug
was fixed.
Basically resolve_overloaded_builtin will resolve __sync_sub_and_fetch into
__sync_sub_and_fetch_1 and add a cast for the return value to the same type as
the first argument this is done in sync_resolve_return.
48ae6c138ca3 (Richard Henderson 2005-04-14 16:37:47 -0700 8801)
result = build_function_call (new_function, params);
48ae6c138ca3 (Richard Henderson 2005-04-14 16:37:47 -0700 8802)
if (orig_code != BUILT_IN_BOOL_COMPARE_AND_SWAP_N
48ae6c138ca3 (Richard Henderson 2005-04-14 16:37:47 -0700 8803)
&& orig_code != BUILT_IN_LOCK_RELEASE_N)
48ae6c138ca3 (Richard Henderson 2005-04-14 16:37:47 -0700 8804)
result = sync_resolve_return (params, result);
So unless there is something wrong with the way sh implements these functions
in libgcc there is no issue in the middle-end.