From 3f3430400b2ce552a5dbdae49a3a482687b96afa Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 3 Feb 2017 16:38:15 +0000 Subject: PR tree-optimization/79352 - -fprintf-return-value doesn't handle flexible-like array members properly gcc/ChangeLog: PR tree-optimization/79352 * gimple-fold.c (get_range_strlen): Add argument. (get_range_strlen): Change return type to bool. (get_maxval_strlen): Pass in a dummy argument. * gimple-fold.h (get_range_strlen): Change return type to bool. * gimple-ssa-sprintf.c (get_string_length): Set unlikely counter. * tree.h (array_at_struct_end_p): Add argument. * tree.c (array_at_struct_end_p): Handle it. gcc/testsuite/ChangeLog: PR tree-optimization/79352 * gcc.dg/tree-ssa/pr79352.c: New test. From-SVN: r245156 --- gcc/tree.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/tree.h') diff --git a/gcc/tree.h b/gcc/tree.h index 6341446..f63a678 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4855,8 +4855,10 @@ extern tree array_ref_low_bound (tree); /* Returns true if REF is an array reference to an array at the end of a structure. If this is the case, the array may be allocated larger - than its upper bound implies. */ -extern bool array_at_struct_end_p (tree); + than its upper bound implies. When second argument is true considers + REF when it's a COMPONENT_REF in addition ARRAY_REF and + ARRAY_RANGE_REF. */ +extern bool array_at_struct_end_p (tree, bool = false); /* Return a tree representing the offset, in bytes, of the field referenced by EXP. This does not include any offset in DECL_FIELD_BIT_OFFSET. */ -- cgit v1.1