aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.h
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-07-09 20:33:48 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-07-09 14:33:48 -0600
commit35b4d3a644222b7bd69b3a1e9c00e78f3dbf3eba (patch)
treea540d226c0eeee38bd5ea06483ae688c1e0c070e /gcc/fold-const.h
parentaad2444d346d4ae504a938de8708341dd1889aed (diff)
downloadgcc-35b4d3a644222b7bd69b3a1e9c00e78f3dbf3eba.zip
gcc-35b4d3a644222b7bd69b3a1e9c00e78f3dbf3eba.tar.gz
gcc-35b4d3a644222b7bd69b3a1e9c00e78f3dbf3eba.tar.bz2
PR middle-end/77357 - strlen of constant strings not folded
gcc/ChangeLog: PR middle-end/77357 PR middle-end/86428 * builtins.c (c_strlen): Avoid out-of-bounds warnings when accessing implicitly initialized array elements. * expr.c (string_constant): Handle string initializers of character arrays within aggregates. * gimple-fold.c (fold_array_ctor_reference): Add argument. Store element offset. As a special case, handle zero size. (fold_nonarray_ctor_reference): Same. (fold_ctor_reference): Add argument. Store subobject offset. * gimple-fold.h (fold_ctor_reference): Add argument. gcc/testsuite/ChangeLog: PR middle-end/77357 * gcc.dg/strlenopt-49.c: New test. * gcc.dg/strlenopt-50.c: New test. * gcc.dg/strlenopt-51.c: New test. * gcc.dg/strlenopt-52.c: New test. From-SVN: r262522
Diffstat (limited to 'gcc/fold-const.h')
-rw-r--r--gcc/fold-const.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index c64b8d0..4613a62 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -183,7 +183,8 @@ extern bool expr_not_equal_to (tree t, const wide_int &);
extern tree const_unop (enum tree_code, tree, tree);
extern tree const_binop (enum tree_code, tree, tree, tree);
extern bool negate_mathfn_p (combined_fn);
-extern const char *c_getstr (tree, unsigned HOST_WIDE_INT *strlen = NULL);
+extern const char *c_getstr (tree, unsigned HOST_WIDE_INT * = NULL,
+ unsigned HOST_WIDE_INT * = NULL);
extern wide_int tree_nonzero_bits (const_tree);
/* Return OFF converted to a pointer offset type suitable as offset for