aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2018-07-16 18:03:15 +0000
committerBernd Edlinger <edlinger@gcc.gnu.org>2018-07-16 18:03:15 +0000
commit5828c09abe00cce5ddff7eefef274c48021c72c9 (patch)
tree02407fe16cba02310f6f45f81b7d684f739a7be5 /gcc/expr.c
parentb8c9cad352b8c40693dd7f6b15aec17bfb37c2a1 (diff)
downloadgcc-5828c09abe00cce5ddff7eefef274c48021c72c9.zip
gcc-5828c09abe00cce5ddff7eefef274c48021c72c9.tar.gz
gcc-5828c09abe00cce5ddff7eefef274c48021c72c9.tar.bz2
re PR middle-end/86528 (strlen of constant string malfunction -- had to back out fix for PR middle-end/77357)
gcc: 2018-07-16 Bernd Edlinger <bernd.edlinger@hotmail.de> PR middle-end/86528 * builtins.c (check_access): Bail out if range[0] is no INTEGER_CST. * expr.c (string_constant): Fix the element size of ARRAY_TYPE. testsuite: 2018-07-16 Bernd Edlinger <bernd.edlinger@hotmail.de> PR middle-end/86528 * gcc.c-torture/execute/pr86528.c: New test. * gcc.dg/Wrestrict-10.c (test_arr_strcat_2): Fix typo. From-SVN: r262742
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 797b1f5..f665e187 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -11341,7 +11341,9 @@ string_constant (tree arg, tree *ptr_offset)
tree offset = wide_int_to_tree (sizetype, base_off);
if (varidx)
{
- if (tree eltsize = TYPE_SIZE_UNIT (TREE_TYPE (array)))
+ if (TREE_CODE (TREE_TYPE (array)) != ARRAY_TYPE)
+ return NULL_TREE;
+ if (tree eltsize = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (array))))
{
/* Add the scaled variable index to the constant offset. */
tree eltoff = fold_build2 (MULT_EXPR, TREE_TYPE (offset),