From: Steven G. Kargl Date: Fri, 23 Feb 2018 18:59:38 +0000 (+0000) Subject: re PR fortran/84511 (Internal compiler error from directly printing return of C_LOC) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a26f63a80e103b2eb75cb8ee5012eb9f6afac9c3;p=gcc.git re PR fortran/84511 (Internal compiler error from directly printing return of C_LOC) 2018-02-23 Steven G. Kargl PR fortran/84511 * trans-io.c (transfer_expr): Deal with C_LOC in transfer statement. From-SVN: r257943 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index da2c445ec15..fa1a00b7050 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-02-23 Steven G. Kargl + + PR fortran/84511 + * trans-io.c (transfer_expr): Deal with C_LOC in transfer statement. + 2018-02-23 Steven G. Kargl PR fortran/84346 diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 36adb034475..9058712c695 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;