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: [PATCH] Compile time buffer overflow checks for strncat


On Mon, Sep 18, 2006 at 01:28:47PM -0700, Geoffrey Keating wrote:
> > 2006-09-18  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	* tree-ssa-propagate.c (set_rhs): Copy EXPR_LOCATION if
> > 	needed.
> 
> This is OK.
> 
> > 	* builtins.c (expand_builtin, maybe_emit_chk_warning): Handle
> > 	BUILT_IN_STRNCAT_CHK.
> 
> Don't you need to change fold_builtin_1 too?

No, fold_builtin_1 already handles BUILT_IN_STRNCAT_CHK, by calling
fold_builtin_strncat_chk.  The maybe_emit_chk_warning call in
expand_builtin doesn't change code generation, it is always expanded
using expand_call to the runtime checking builtin.  All
maybe_emit_chk_warning does is check if a warning should be reported
and report it.

> > 	* gcc.dg/builtin-strncat-chk-1.c: New test.
> 
> This part is fine.

	Jakub


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