This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/39480


Jason Merrill <jason@redhat.com> writes:

> Richard Guenther wrote:
>> +         if (!(optimize && flag_tree_ter))
>> +           {
>> +             /* When TER is off get_pointer_alignment returns 0, so a call
>> +                to __builtin_memcpy is expanded as a call to memcpy, which
>> +                is invalid with identical args.  When TER is on it is
>> +                expanded as a block move, which should be safe.  */
>>
>> This reasoning is not entirely clear to me (that is, it looks fragile to
>> rely on TER doing anything).
>
> I'm not relying on TER doing anything, just mirroring the logic in
> get_pointer_alignment so that we add this test in the exact same
> situations that expand_builtin_memcpy gives up and returns NULL.

The chance of this logic remaining in sync over time seems rather low,
especially since the code is in two different directories.  I think that
on mainline the condition, trivial as it is, ought to move into a
function in builtins.c.  I'll preapprove the patch to builtins.c.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]