c/10339: [sparc] Invalid optimization: replacing strncmp by memcmp

Alan Modra amodra@bigpond.net.au
Tue Apr 8 01:13:00 GMT 2003


On Mon, Apr 07, 2003 at 06:42:47PM -0000, bangerth@dealii.org wrote:
> Old Synopsis: strncmp generates imPure code
> New Synopsis: [sparc] Invalid optimization: replacing strncmp by memcmp

Also happens on powerpc-linux and powerpc64-linux.  Incidentally,
I think Andreas' suggestion that memcmp is allowed to compare from
the upper end of the arrays is not very likely to happen given
memcmp's return value.  A more reasonable objection to the
strncmp -> memcmp transformation is that a memcmp implementation
might load multiple words into registers (say a cache-line worth),
before comparing.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Gcc-bugs mailing list