Thanks for the review. I will commit tomorrow. --- Fritz Reese
On Sat, Jun 23, 2018 at 11:57 AM, Steve Kargl <s...@troutmask.apl.washington.edu> wrote: > On Fri, Jun 22, 2018 at 04:46:19PM -0400, Fritz Reese wrote: >> >> In any case, the changelog is here, and the patch is attached. Aside >> from the issues mentioned below the compile bootstraps and regression >> tests successfully. Does this look OK for trunk? Furthermore, this >> patch comes a bit late as the PRs were submitted before 8.1 was >> released; is it appropriate to backport this to 7-branch and/or >> 8-branch? > > OK with minor style fixes (see below). Note, I cannot reproduce > the issues that you saw. Please keep an eye on the list for a > regression. > >> +/* Generate an initializer expression for an iso_c_binding type >> + such as c_[fun]ptr. The appropriate initializer is c_null_[fun]ptr. */ >> + >> +static gfc_expr * >> +generate_isocbinding_initializer (gfc_symbol *derived) >> +{ >> + /* The initializers have already been built into the c_null_[fun]ptr >> symbols >> + from gen_special_c_interop_ptr. */ >> + >> + gfc_symtree *npsym = NULL; >> + if (0 == strcmp(derived->name, "c_ptr")) > > Missing space. strcmp () > >> + gfc_find_sym_tree("c_null_ptr", gfc_current_ns, true, &npsym); > > same here > >> + else if (0 == strcmp(derived->name, "c_funptr")) > > same here > >> + gfc_find_sym_tree("c_null_funptr", gfc_current_ns, true, &npsym); > > same here > >> + else >> + gfc_internal_error ("generate_isocbinding_initializer(): bad >> iso_c_binding" >> + " type, expected %<c_ptr%> or %<c_funptr%>"); >> + if (npsym) >> + { >> + gfc_expr *init = gfc_copy_expr(npsym->n.sym->value); > > same here > >> + init->symtree = npsym; >> + init->ts.is_iso_c = true; >> + return init; >> + } >> + >> + return NULL; >> +} >> >> /* Get or generate an expression for a default initializer of a derived >> type. >> If -finit-derived is specified, generate default initialization >> expressions >> @@ -4498,8 +4525,12 @@ gfc_generate_initializer (gfc_typespec *ts, bool >> generate) >> { >> gfc_expr *init, *tmp; >> gfc_component *comp; >> + >> generate = flag_init_derived && generate; >> >> + if (ts->u.derived->ts.is_iso_c && generate) >> + return generate_isocbinding_initializer(ts->u.derived); > > same here > > -- > Steve