Message ID | 824f92e3-04b7-c309-6407-63b3e2634f6e@netcologne.de |
---|---|
State | New |
Headers | show |
Series | [fortran] Fix PR 89384 | expand |
Hi Thomas, That's just the job. OK for trunk. Thanks for the quick fix. Paul On Mon, 18 Feb 2019 at 22:03, Thomas Koenig <tkoenig@netcologne.de> wrote: > > Hello world, > > this patch fixes the 9 regression in C interop with contiguous > arguments recently reported by Reinhold Bader. > > ChangeLog and patch say it all. I hope I didn't overlook any > obvious things here (Paul, maybe you can take a look). > > Regression-tested. OK for trunk? > > Regards > > Thomas > > 2019-02-18 Thomas Koenig <tkoenig@gcc.gnu.org> > > PR fortran/89384 > * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): If the dummy > argument is contiguous and the actual argument may not be, > use gfc_conv_subref_array_arg. > > 2019-02-18 Thomas Koenig <tkoenig@gcc.gnu.org> > > PR fortran/89384 > * gfortran.dg/ISO_Fortran_binding_4.f90
Index: trans-expr.c =================================================================== --- trans-expr.c (Revision 268992) +++ trans-expr.c (Arbeitskopie) @@ -4944,7 +4944,12 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc if (e->rank != 0) { - gfc_conv_expr_descriptor (parmse, e); + if (fsym->attr.contiguous + && !gfc_is_simply_contiguous (e, false, true)) + gfc_conv_subref_array_arg (parmse, e, false, fsym->attr.intent, + fsym->attr.pointer); + else + gfc_conv_expr_descriptor (parmse, e); if (POINTER_TYPE_P (TREE_TYPE (parmse->expr))) parmse->expr = build_fold_indirect_ref_loc (input_location,