This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Compile time buffer overflow checks for strncat
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Geoffrey Keating <geoffk at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Sep 2006 16:35:12 -0400
- Subject: Re: [PATCH] Compile time buffer overflow checks for strncat
- References: <20060918185549.GZ12531@devserv.devel.redhat.com> <m2venk6hs0.fsf@greed.local>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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