aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authorFeng Wang <fengwang@nudt.edu.cn>2005-03-15 02:52:38 +0000
committerFeng Wang <fengwang@gcc.gnu.org>2005-03-15 02:52:38 +0000
commitce2df7c64ae0185dab22bb38628acf8ae48551b7 (patch)
tree9d626c10efe2ea1ff72bf8bd94fa123c776b3dad /gcc/fortran/trans-io.c
parent08091139067ee2565a3ad248bd0113e521a425ee (diff)
downloadgcc-ce2df7c64ae0185dab22bb38628acf8ae48551b7.zip
gcc-ce2df7c64ae0185dab22bb38628acf8ae48551b7.tar.gz
gcc-ce2df7c64ae0185dab22bb38628acf8ae48551b7.tar.bz2
re PR fortran/18827 (ICE on assign to common variable)
fortran/ 2005-03-15 Feng Wang <fengwang@nudt.edu.cn> PR fortran/18827 * io.c (resolve_tag): Add checking on assigned label. (match_dt_format): Does not set symbol assign attribute. * match.c (gfc_match_goto):Does not set symbol assign attribute. * resolve.c (resolve_code): Add checking on assigned label. * trans-common.c (build_field): Deals with common variable assigned a label. * trans-stmt.c (gfc_conv_label_variable): New function. (gfc_trans_label_assign): Use it. (gfc_trans_goto): Ditto. * trans-io.c (set_string): Ditto. * trans.h (gfc_conv_label_variable): Add prototype. testsuite/ 2005-03-15 Feng Wang <fengwang@nudt.edu.cn> PR fortran/18827 * gfortran.dg/assign_2.f90: New test. * gfortran.dg/assign_3.f90: New test. * gfortran.dg/assign.f90: New test. From-SVN: r96467
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 26f05f1..4169321 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -397,7 +397,6 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
tree len;
gfc_init_se (&se, NULL);
- gfc_conv_expr (&se, e);
io = build3 (COMPONENT_REF, TREE_TYPE (var), ioparm_var, var, NULL_TREE);
len = build3 (COMPONENT_REF, TREE_TYPE (var_len), ioparm_var, var_len,
@@ -406,6 +405,7 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
/* Integer variable assigned a format label. */
if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
{
+ gfc_conv_label_variable (&se, e);
msg =
gfc_build_cstring_const ("Assigned label is not a format label");
tmp = GFC_DECL_STRING_LEN (se.expr);
@@ -417,6 +417,7 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
}
else
{
+ gfc_conv_expr (&se, e);
gfc_conv_string_parameter (&se);
gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
gfc_add_modify_expr (&se.pre, len, se.string_length);