aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-02-23 18:59:38 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-02-23 18:59:38 +0000
commita26f63a80e103b2eb75cb8ee5012eb9f6afac9c3 (patch)
tree9d9dd4817847b6083eb1a205c198255ad7fc5a23 /gcc/fortran/trans-io.c
parent3453b6aa30c11a7c86cc91197f7ee97bc49cb273 (diff)
downloadgcc-a26f63a80e103b2eb75cb8ee5012eb9f6afac9c3.zip
gcc-a26f63a80e103b2eb75cb8ee5012eb9f6afac9c3.tar.gz
gcc-a26f63a80e103b2eb75cb8ee5012eb9f6afac9c3.tar.bz2
re PR fortran/84511 (Internal compiler error from directly printing return of C_LOC)
2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/84511 * trans-io.c (transfer_expr): Deal with C_LOC in transfer statement. From-SVN: r257943
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 36adb03..9058712 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -2289,6 +2289,16 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr,
ts->kind = gfc_index_integer_kind;
}
+ /* gfortran reaches here for "print *, c_loc(xxx)". */
+ if (ts->type == BT_VOID
+ && code->expr1 && code->expr1->ts.type == BT_VOID
+ && code->expr1->symtree
+ && strcmp (code->expr1->symtree->name, "c_loc") == 0)
+ {
+ ts->type = BT_INTEGER;
+ ts->kind = gfc_index_integer_kind;
+ }
+
kind = ts->kind;
function = NULL;
arg2 = NULL;