public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 3/3] gimple-fold: Use ranges to simplify strncat and snprintf
Date: Mon, 15 Nov 2021 16:11:39 +0530	[thread overview]
Message-ID: <eb82480f-8802-b4ab-1673-5dec995f87fe@gotplt.org> (raw)
In-Reply-To: <20211111194116.1626980-4-siddhesh@gotplt.org>

On 11/12/21 01:11, Siddhesh Poyarekar wrote:
> Remove the warnings for strncat since it is already handled (and even
> the error messages look identical) in gimple-ssa-warn-access.  Instead,
> use len range to determine if it is within bounds of source and
> destination and simplify it to strcat if it's safe.
> 
> Likewise for snprintf, use ranges to determine if it can be transformed
> to strcpy.
> 
> gcc/ChangeLog:
> 
> 	* gimple-fold.c (gimple_fold_builtin_strncat): Remove warnings
> 	and use ranges to determine if it is safe to transform to
> 	strcat.
> 	(gimple_fold_builtin_snprintf): Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/fold-stringops-2.c: Define size_t.
> 	(safe1): Adjust.
> 	(safe4): New test.
> 	* gcc.dg/fold-stringops-3.c: New test.
> 

Sorry, it looks like my last test run was stale and didn't catch the 
regressions dropping warnings caused.  I'll bring back the warnings in 
v2 with ranges.

Siddhesh

  reply	other threads:[~2021-11-15 10:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 19:41 [PATCH 0/3] gimple-fold improvements Siddhesh Poyarekar
2021-11-11 19:41 ` [PATCH 1/3] gimple-fold: Transform stp*cpy_chk to str*cpy directly Siddhesh Poyarekar
2021-11-12 17:16   ` Prathamesh Kulkarni
2021-11-14  5:48     ` Siddhesh Poyarekar
2021-11-11 19:41 ` [PATCH 2/3] gimple-fold: Use ranges to simplify _chk calls Siddhesh Poyarekar
2021-11-11 19:41 ` [PATCH 3/3] gimple-fold: Use ranges to simplify strncat and snprintf Siddhesh Poyarekar
2021-11-15 10:41   ` Siddhesh Poyarekar [this message]
2021-11-15 17:33 ` [PATCH v2 0/3] gimple-fold improvements Siddhesh Poyarekar
2021-11-15 17:33   ` [PATCH v2 1/3] gimple-fold: Transform stp*cpy_chk to str*cpy directly Siddhesh Poyarekar
2021-11-15 19:17     ` Jeff Law
2021-11-15 17:33   ` [PATCH v2 2/3] gimple-fold: Use ranges to simplify _chk calls Siddhesh Poyarekar
2021-11-15 20:25     ` Jeff Law
2021-11-15 22:53       ` Siddhesh Poyarekar
2021-11-15 17:33   ` [PATCH v2 3/3] gimple-fold: Use ranges to simplify strncat and snprintf Siddhesh Poyarekar
2021-11-15 19:38     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb82480f-8802-b4ab-1673-5dec995f87fe@gotplt.org \
    --to=siddhesh@gotplt.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).