Commit 37cd3454 by Martin Sebor Committed by Martin Sebor

PR middle-end/92622 - FAIL: gcc.dg/Warray-bounds-22.c on ILP32: missing warnings…

PR middle-end/92622 - FAIL: gcc.dg/Warray-bounds-22.c on ILP32: missing warnings for VLA on lines 67 and 69

gcc/ChangeLog:

	PR middle-end/92622
	* tree-vrp.c (vrp_prop::check_array_ref): Avoid using a variable
	left uninitialized by get_addr_base_and_unit_offset ofn failure.

From-SVN: r279029
parent b801c7cd
2019-12-05 Martin Sebor <msebor@redhat.com>
PR middle-end/92622
* tree-vrp.c (vrp_prop::check_array_ref): Avoid using a variable
left uninitialized by get_addr_base_and_unit_offset on failure.
2019-12-05 Jan Hubicka <hubicka@ucw.cz> 2019-12-05 Jan Hubicka <hubicka@ucw.cz>
* ipa-prop.c (ipa_set_jf_unknown): Do not clear bits and m_vr. * ipa-prop.c (ipa_set_jf_unknown): Do not clear bits and m_vr.
...@@ -3516,7 +3516,6 @@ vrp_prop::check_array_ref (location_t location, tree ref, ...@@ -3516,7 +3516,6 @@ vrp_prop::check_array_ref (location_t location, tree ref,
tree ptrdiff_max = TYPE_MAX_VALUE (ptrdiff_type_node); tree ptrdiff_max = TYPE_MAX_VALUE (ptrdiff_type_node);
tree maxbound = ptrdiff_max; tree maxbound = ptrdiff_max;
tree arg = TREE_OPERAND (ref, 0); tree arg = TREE_OPERAND (ref, 0);
poly_int64 off;
const bool compref = TREE_CODE (arg) == COMPONENT_REF; const bool compref = TREE_CODE (arg) == COMPONENT_REF;
if (compref) if (compref)
...@@ -3535,8 +3534,10 @@ vrp_prop::check_array_ref (location_t location, tree ref, ...@@ -3535,8 +3534,10 @@ vrp_prop::check_array_ref (location_t location, tree ref,
size wouldn't necessarily be correct if the reference is size wouldn't necessarily be correct if the reference is
to its flexible array member initialized in a different to its flexible array member initialized in a different
translation unit. */ translation unit. */
tree base = get_addr_base_and_unit_offset (arg, &off); poly_int64 off;
if (!compref && base && DECL_P (base)) if (tree base = get_addr_base_and_unit_offset (arg, &off))
{
if (!compref && DECL_P (base))
if (tree basesize = DECL_SIZE_UNIT (base)) if (tree basesize = DECL_SIZE_UNIT (base))
if (TREE_CODE (basesize) == INTEGER_CST) if (TREE_CODE (basesize) == INTEGER_CST)
{ {
...@@ -3549,6 +3550,7 @@ vrp_prop::check_array_ref (location_t location, tree ref, ...@@ -3549,6 +3550,7 @@ vrp_prop::check_array_ref (location_t location, tree ref,
wi::sub (wi::to_wide (maxbound), wi::sub (wi::to_wide (maxbound),
off)); off));
} }
}
else else
maxbound = fold_convert (sizetype, maxbound); maxbound = fold_convert (sizetype, maxbound);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment