[Bug middle-end/93582] [10 Regression] -Warray-bounds gives error: array subscript 0 is outside array bounds of struct E[1]
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 5 07:02:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93582
--- Comment #40 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:fe19699ae2883b252d30f98481d32dabff00744b
commit r10-7035-gfe19699ae2883b252d30f98481d32dabff00744b
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 5 08:00:04 2020 +0100
sccvn: Fix handling of POINTER_PLUS_EXPR in memset offset [PR93582]
> > where POINTER_PLUS_EXPR last operand has sizetype type, thus unsigned,
> > and in the testcase gimple_assign_rhs2 (def) is thus
0xf000000000000001ULL
> > which multiplied by 8 doesn't fit into signed HWI. If it would be
treated
> > as signed offset instead, it would fit (-0xfffffffffffffffLL,
multiplied
> > by 8 is -0x7ffffffffffffff8LL). Unfortunately with the poly_int
obfuscation
> > I'm not sure how to convert it from unsigned to signed poly_int.
>
> mem_ref_offset provides a boiler-plate for this:
>
> poly_offset_int::from (wi::to_poly_wide (TREE_OPERAND (t, 1)), SIGNED);
Thanks, that seems to work.
The test now works on both big-endian and little-endian.
2020-03-05 Richard Biener <rguenther@suse.de>
Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/93582
* tree-ssa-sccvn.c (vn_reference_lookup_3): Treat POINTER_PLUS_EXPR
last operand as signed when looking for memset offset. Formatting
fix.
* gcc.dg/tree-ssa/pr93582-11.c: New test.
Co-authored-by: Richard Biener <rguenther@suse.de>
More information about the Gcc-bugs
mailing list