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]

Re: Patch to add builtin strncmp and builtin strncpy


 > From: Richard Henderson <rth@redhat.com>
 > 
 > On Mon, Nov 27, 2000 at 10:49:55AM -0500, Kaveh R. Ghazi wrote:
 > > Strange, it seemed to pass the testcases perhaps because I passed in
 > > the target/mode from the original call. 
 > 
 > It would be truncated back down to a const_int unless you
 > are cross-compiling to a larger word machine.
 > 
 > > +      /* OK transform into builtin memcpy.  */
 > > +      return expand_builtin_memcpy (arglist);
 > 
 > This won't result in a call to memcpy if the builtin expansion
 > fails, will it?
 > r~

It won't call memcpy if the expansion fails.  In that case,
expand_builtin_memcpy will return a 0, which when passed back through
expand_builtin_strncpy causes the original call to strncpy to be
issued.

(It might however call memcpy if the expansion succeeds and
emit_block_move decides it can't move by pieces.  But that's OK given
the constraints under which expand_builtin_memcpy is called here.)

I haven't actually tested this specific scenario though.

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions

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