[PATCH,fortran]: fix part of PR 32600
Christopher D. Rickett
crickett@lanl.gov
Wed Jul 18 18:08:00 GMT 2007
hi all,
the attached patch addresses the C_LOC part of PR 32600, allowing for
C_LOC to be inlined.
bootstrapped and regtested on x86 and x86_64 linux with no new failures.
Chris
:ADDPATCH fortran:
2007-07-18 Christopher D. Rickett <crickett@lanl.gov>
PR fortran/32600
* trans-expr.c (gfc_conv_function_call): Inline C_LOC.
-------------- next part --------------
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (revision 126704)
+++ gcc/fortran/trans-expr.c (working copy)
@@ -2060,6 +2061,33 @@ gfc_conv_function_call (gfc_se * se, gfc
var = NULL_TREE;
len = NULL_TREE;
+ if (sym->from_intmod == INTMOD_ISO_C_BINDING
+ && sym->intmod_sym_id == ISOCBINDING_LOC)
+ {
+ if (arg->expr->rank == 0)
+ {
+ gfc_conv_expr_reference (se, arg->expr);
+ }
+ else
+ {
+ int f;
+ /* This is really the actual arg because no formal arglist is
+ created for C_LOC. */
+ fsym = arg->expr->symtree->n.sym;
+
+ /* We should want it to do g77 calling convention. */
+ f = (fsym != NULL)
+ && !(fsym->attr.pointer || fsym->attr.allocatable)
+ && fsym->as->type != AS_ASSUMED_SHAPE;
+ f = f || !sym->attr.always_explicit;
+
+ argss = gfc_walk_expr (arg->expr);
+ gfc_conv_array_parameter (se, arg->expr, argss, f);
+ }
+
+ return 0;
+ }
+
if (se->ss != NULL)
{
if (!sym->attr.elemental)
More information about the Fortran
mailing list