aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2016-01-26 21:57:12 +0000
committerPaul Thomas <pault@gcc.gnu.org>2016-01-26 21:57:12 +0000
commita0909527ea43a796239cd68c7354a3a4447852b7 (patch)
tree5331c8663e115052957bc948d2c8726950cbc3dd /gcc/fortran
parentca30abcd13617314b7de526da03802639a2a7fc7 (diff)
downloadgcc-a0909527ea43a796239cd68c7354a3a4447852b7.zip
gcc-a0909527ea43a796239cd68c7354a3a4447852b7.tar.gz
gcc-a0909527ea43a796239cd68c7354a3a4447852b7.tar.bz2
[multiple changes]
2016-01-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/69385 * trans-expr.c (gfc_trans_assignment_1): Exclude initialization assignments from check on assignment of scalars to unassigned arrays and correct wrong code within the corresponding block. 2015-01-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/69385 * gfortran.dg/allocate_error_6.f90: New test. From-SVN: r232850
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-expr.c18
2 files changed, 18 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a137e91..0a55a09 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-26 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/69385
+ * trans-expr.c (gfc_trans_assignment_1): Exclude initialization
+ assignments from check on assignment of scalars to unassigned
+ arrays and correct wrong code within the corresponding block.
+
2016-01-26 David Malcolm <dmalcolm@redhat.com>
PR other/69006
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 40a971f..5031a37 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -9286,6 +9286,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
{
gfc_conv_expr (&lse, expr1);
if (gfc_option.rtcheck & GFC_RTCHECK_MEM
+ && !init_flag
&& gfc_expr_attr (expr1).allocatable
&& expr1->rank
&& !expr2->rank)
@@ -9293,14 +9294,17 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
tree cond;
const char* msg;
- tmp = expr1->symtree->n.sym->backend_decl;
- if (POINTER_TYPE_P (TREE_TYPE (tmp)))
- tmp = build_fold_indirect_ref_loc (input_location, tmp);
+ /* We should only get array references here. */
+ gcc_assert (TREE_CODE (lse.expr) == POINTER_PLUS_EXPR
+ || TREE_CODE (lse.expr) == ARRAY_REF);
- if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (tmp)))
- tmp = gfc_conv_descriptor_data_get (tmp);
- else
- tmp = TREE_OPERAND (lse.expr, 0);
+ /* 'tmp' is either the pointer to the array(POINTER_PLUS_EXPR)
+ or the array itself(ARRAY_REF). */
+ tmp = TREE_OPERAND (lse.expr, 0);
+
+ /* Provide the address of the array. */
+ if (TREE_CODE (lse.expr) == ARRAY_REF)
+ tmp = gfc_build_addr_expr (NULL_TREE, tmp);
cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
tmp, build_int_cst (TREE_TYPE (tmp), 0));