This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [2/2] PR 80769: Incorrect strlen optimisation
- From: Richard Sandiford <richard dot sandiford at linaro dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 02 Jul 2017 12:33:40 +0100
- Subject: Re: [2/2] PR 80769: Incorrect strlen optimisation
- Authentication-results: sourceware.org; auth=none
- References: <87h90lut4v.fsf@linaro.org> <20170630155141.GL2123@tucnak>
Jakub Jelinek <jakub@redhat.com> writes:
> On Tue, May 16, 2017 at 09:02:08AM +0100, Richard Sandiford wrote:
>> 2017-05-16 Richard Sandiford <richard.sandiford@linaro.org>
>>
>> gcc/
>> PR tree-optimization/80769
>> * tree-ssa-strlen.c (strinfo): Document that "stmt" is also used
>> for malloc and calloc. Document the new invariant that all related
>> strinfos have delayed lengths or none do.
>> (verify_related_strinfos): Move earlier in file.
>> (set_endptr_and_length): New function, split out from...
>> (get_string_length): ...here. Also set the lengths of related
>> strinfos.
>> (zero_length_string): Assert that chainsi has known (rather than
>> delayed) lengths.
>> (adjust_related_strinfos): Likewise.
>>
>> gcc/testsuite/
>> PR tree-optimization/80769
>> * gcc.dg/strlenopt-31.c: New test.
>> * gcc.dg/strlenopt-31g.c: Likewise.
>
> Ok for trunk, sorry for the delay. I assume 7.x is not affected, right?
Thanks, applied. 6.x and 7.x have it too, so I'll try to backport
a minimal fix if there's no fallout on trunk.
Richard