Re: [PATCH] lib/string.c: Disable tree-loop-distribute-patterns

From: Linus Torvalds
Date: Tue Aug 18 2020 - 20:44:26 EST


On Tue, Aug 18, 2020 at 4:43 PM Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> This by itself is insufficient for gcc if the optimization was
> explicitly enabled by CFLAGS, so also add a flag to explicitly disable
> it.

Using -fno-tree-loop-distribute-patterns seems to really be a bit too
incestuous with internal compiler knowledge.

That generic memcpy implementation is horrible anyway. It should never be used.

So I'd rather see this either removed entirely, ot possibly rewritten
to be a somewhat proper memcpy implementation, and in the process made
to not be recognizable by the compiler (possibly by adding a dummy
barrier() or something like that).

Looking at the implementation of "strscpy()" in the same file, and
then comparing that to the ludicrously simplisting "memcpy()", I
really get the feeling that that memcpy() is not worth having.

Linus