This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix pdftex miscompilation due to get_range_strlen (PR tree-optimization/84478)
- From: Jeff Law <law at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Martin Sebor <msebor at gmail dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Feb 2018 20:31:06 -0700
- Subject: Re: [PATCH] Fix pdftex miscompilation due to get_range_strlen (PR tree-optimization/84478)
- Authentication-results: sourceware.org; auth=none
- References: <20180220171712.GH5867@tucnak> <d959a1e4-5dfd-c9ce-8e3d-e77f3195faec@gmail.com> <20180220204948.GJ5867@tucnak> <6f9446cc-e61c-7f6b-1270-2b47546726f2@gmail.com> <20180221001451.GL5867@tucnak>
On 02/20/2018 05:14 PM, Jakub Jelinek wrote:
> On Tue, Feb 20, 2018 at 04:59:12PM -0700, Martin Sebor wrote:
>>> It would help if you explained why you think it is a good idea
>>> ignoring the other phi arguments if you have one (or more) where you can
>>> determine length.
>>
>> It's a heuristic that was meant just for the -Wformat-overflow
>> warning. When making decisions that affect code generation it's
>> obviously not correct to ignore the possibility that unknown
>> arguments may be shorter than the minimum or longer than
>> the maximum. The fuzzy argument was meant to differentiate
>> between two got but I forgot about it when I added the fix
>> for PR 83671.
>
> get_range_strlen (the 2 argument one) is right now called:
> 3 times from builtins.c for -Wstringop-overflow
> once from gimple-ssa-sprintf.c for -Wformat-overflow
> once from tree-ssa-strlen.c for -Wstringop-truncation
> once from gimple-fold.c for gimple_fold_builtin_strlen value ranges
Presumably it's the last one that's causing problems and were we should
focus our effort.
>
> So, which of these do you want the heuristics for? All 3 warnings,
> just one of them, something else? In the 2 patches I've posted last
> all the 3 different warnings are treated the same (fuzzy == 2).
>
> Looking at strlenopt-40.c testcase, in the test you clearly rely on
> fuzzy argument being set for the value ranges case
> (gimple_fold_builtin_strlen), otherwise many of the
> subtests would fail.
Which tests specifically? I did a real quick scan and didn't see
anything in there that depended on incorrect behavior for the call from
gimple_fold_builtin_strlen. BUt it was a quick scan and I could have
missed something.
jeff