From e10e60cb6e6837eb0335fa1affa8aef71b21ecbf Mon Sep 17 00:00:00 2001 From: Janne Blomqvist Date: Wed, 10 Jan 2018 13:34:45 +0200 Subject: [PATCH] PR 83740 Wrong string length type in bounds check This patch fixes up the formatting and corrects the PR number in the ChangeLog for r256425. gcc/fortran/ChangeLog: 2018-01-10 Janne Blomqvist PR fortran/83740 * trans-array.c (gfc_trans_array_ctor_element): Fix formatting. From-SVN: r256426 --- gcc/fortran/ChangeLog | 7 ++++++- gcc/fortran/trans-array.c | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8ee13b1930f..05ea28ec69f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,11 @@ 2018-01-10 Janne Blomqvist - PR fortran/84740 + PR fortran/83740 + * trans-array.c (gfc_trans_array_ctor_element): Fix formatting. + +2018-01-10 Janne Blomqvist + + PR fortran/83740 * trans-array.c (gfc_trans_array_ctor_element): Convert RHS to the LHS type when assigning. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 8a0afe9101c..e35e0c9195f 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1563,18 +1563,18 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { gfc_add_modify (&se->pre, first_len_val, fold_convert (TREE_TYPE (first_len_val), - se->string_length)); + se->string_length)); first_len = false; } else { /* Verify that all constructor elements are of the same length. */ + tree rhs = fold_convert (TREE_TYPE (first_len_val), + se->string_length); tree cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, first_len_val, - fold_convert (TREE_TYPE - (first_len_val), - se->string_length)); + rhs); gfc_trans_runtime_check (true, false, cond, &se->pre, &expr->where, "Different CHARACTER lengths (%ld/%ld) in array constructor", -- 2.30.2