This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix bogus strncpy source length warning on source bound by constant
- From: Siddhesh Poyarekar <siddhesh at sourceware dot org>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 13 Mar 2018 14:32:28 +0530
- Subject: Re: [PATCH] Fix bogus strncpy source length warning on source bound by constant
- Authentication-results: sourceware.org; auth=none
- References: <20180311152201.9613-1-siddhesh@sourceware.org> <CAFiYyc2XOpeduNvQMe1bYwBU=_nO3vjA=9WANjaxuzgceT9zZA@mail.gmail.com>
On Monday 12 March 2018 03:26 PM, Richard Biener wrote:
> Please use tree_int_cst_lt (rhs1, dstsize) instead.
>
>> + {
>> + gimple_set_no_warning (stmt, true);
>
> Why this? There's only a single bit -- where do we warn from if you
> don't do this here?
I incorrectly thought it was necessary to set that flag but I noticed
now that it isn't. I'll remove it.
> I also wonder why this code doesn't use range-info given the
> INTEGER_CST constraints
> range-info should tell us more than just handling MIN_EXPR?
Right, I'll try using range-info.
Thanks,
Siddhesh