This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR 86572
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jeffrey Law <law at redhat dot com>
- Cc: Bernd Edlinger <bernd dot edlinger at hotmail dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 4 Nov 2018 16:28:43 -0800
- Subject: Re: [PATCH] Fix PR 86572
- References: <VI1PR0701MB2862DEE3CE9F931132E8ECDDE4F40@VI1PR0701MB2862.eurprd07.prod.outlook.com> <43ac7289-028b-7b6b-aac4-431ca20c696f@redhat.com>
On Sun, Nov 4, 2018 at 10:02 AM Jeff Law <law@redhat.com> wrote:
>
> On 10/22/18 9:08 AM, Bernd Edlinger wrote:
> > Hi!
> >
> > This makes c_strlen avoid an unsafe strlen folding of const arguments
> > with non-const offset. Currently a negative out of bounds offset
> > makes the strlen function return an extremely large number, and
> > at the same time, prevents the VRP machinery, to determine the correct
> > range if the strlen function in this case.
> >
> > Fixed by doing the whole computation in size_t and casting the
> > result back to ssize_t.
> >
> >
> > Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> > Is it OK for trunk?
> >
> >
> > Thanks
> > Bernd.
> >
> >
> > patch-pr86572.diff
> >
> > gcc:
> > 2018-10-22 Bernd Edlinger <bernd.edlinger@hotmail.de>
> >
> > PR tree-optimization/86572
> > * builtins.c (c_strlen): Handle negative offsets in a safe way.
> >
> > testsuite:
> > 2018-10-22 Bernd Edlinger <bernd.edlinger@hotmail.de>
> >
> > PR tree-optimization/86572
> > * gcc.dg/pr86572.c: New test.
> OK.
> jeff
This caused:
/export/gnu/import/git/gcc-test-ia32/src-trunk/gcc/testsuite/gcc.dg/warn-strlen-no-nul.c:56:1:
internal compiler error: verify_gimple failed^M
0x8922dc4 verify_gimple_in_seq(gimple*)^M
../../src-trunk/gcc/tree-cfg.c:5082^M
0x86899d7 gimplify_body(tree_node*, bool)^M
../../src-trunk/gcc/gimplify.c:12859^M
0x8689b8b gimplify_function_tree(tree_node*)^M
../../src-trunk/gcc/gimplify.c:12949^M
0x84f7690 cgraph_node::analyze()^M
../../src-trunk/gcc/cgraphunit.c:667^M
0x84fa1d8 analyze_functions^M
../../src-trunk/gcc/cgraphunit.c:1126^M
0x84fadd3 symbol_table::finalize_compilation_unit()^M
../../src-trunk/gcc/cgraphunit.c:2833^M
Please submit a full bug report,^M
with preprocessed source if appropriate.^M
Please include the complete backtrace with any bug report.^M
See <https://gcc.gnu.org/bugs/> for instructions.^M
compiler exited with status 1
FAIL: gcc.dg/warn-strlen-no-nul.c (internal compiler error)
on i386.
--
H.J.