This is the mail archive of the
mailing list for the GCC project.
Re: [Patch, Fortran] PR56907 - do not 'pack' arrays passed to C_LOC
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Fri, 19 Apr 2013 22:12:10 +0200
- Subject: Re: [Patch, Fortran] PR56907 - do not 'pack' arrays passed to C_LOC
- References: <5165C8D0 dot 7020606 at net-b dot de>
> Fortran 2008 supports C_LOC(array); if the argument is not simply
> contiguous, the current code adds a call to __gfortran_intrinsic_pack.
> The pack call shouldn't be there. Fortran 2008 demands that the actual
> argument is contiguous and intrinsic_pack copy creates a copy if the
> run-time check shows that the argument is not contiguous. Thus, it is not a
> wrong-code issue. However, for performance reasons, it makes sense to avoid
> the call __gfortran_intrinsic_pack.
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
finally found a few silent minutes to have a look at this patch.
What I don't quite understand is:
@@ -6317,8 +6317,13 @@ conv_isocbinding_function (gfc_se *se, gfc_expr *expr)
if (arg->expr->rank == 0)
gfc_conv_expr_reference (se, arg->expr);
+ else if (gfc_is_simply_contiguous (arg->expr, false))
gfc_conv_array_parameter (se, arg->expr, true, NULL, NULL, NULL);
+ gfc_conv_expr_descriptor (se, arg->expr);
+ se->expr = gfc_conv_descriptor_data_get (se->expr);
Why doesn't 'gfc_conv_array_parameter' handle this situation properly?
After all there is code like this inside:
no_pack = (...)
gfc_is_simply_contiguous (expr, false));
Wouldn't it be better to fix the logic in there, instead of avoiding
to call it alltogether? This might also help in other situations ...