[PATCH] gimple-fold: Transform stp*cpy_chk to strcpy

Jeff Law jeffreyalaw@gmail.com
Wed Nov 10 20:36:58 GMT 2021

On 11/10/2021 10:47 AM, Siddhesh Poyarekar wrote:
> Use the ignore flag to transform BUILT_IN_STPCPY_CHK to BUILT_IN_STRCPY
> when set.  This transformation will happen in a subsequent fold anyway
> but do it right away and save the additional effort.
> gcc/ChangeLog:
> 	* gimple-fold.c (gimple_fold_builtin_stxcpy_chk,
> 	gimple_fold_builtin_stxncpy_chk): Use BUILT_IN_STRNCPY if return
> 	value is not used.

Note we usually want testcases for this kind of stuff too.  It's not 
strictly necessary, but it's hard to go wrong if you're including a test 
that verifies your transformation happens at the point where you expect 
it to happen.


More information about the Gcc-patches mailing list