This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/28353] ICE: Segmentation fault



------- Comment #4 from paul dot richard dot thomas at cea dot fr  2006-07-12 11:54 -------
Tobias,

I am so glad to see that somebody is passing components of derived type arrays;
I bust myself to make that work!  Anyway, I partially broke it with a recent
patch - sorry.

Reduced testcase:

SUBROUTINE mpi_bc_all(lda_u, ntypd)
  TYPE t_utype
    INTEGER l
  END TYPE t_utype
  TYPE (t_utype), INTENT (INOUT) :: lda_u(ntypd)
  EXTERNAL MPI_BCAST
  CALL MPI_BCAST(lda_u(:)%l) ! No explicit interface -> no fsym -> segfault
END SUBROUTINE mpi_bc_all

A work around is to add an interface:

  interface
    subroutine MPI_BCAST (i)
      integer, dimension (:) :: i
    end subroutine MPI_BCAST
  end interface

Here is a patch that works.  It is not regtested but I am sure that it is
bombproof.  I will do all the regtesting tonight and commit it as "obvious"
tomorrow morning.

Patch:

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c    (r├®vision 115306)
+++ gcc/fortran/trans-expr.c    (copie de travail)
@@ -1980,7 +1980,8 @@
                   array of derived types.  In this case, the argument
                   is converted to a temporary, which is passed and then
                   written back after the procedure call.  */
-               gfc_conv_aliased_arg (&parmse, e, f, fsym->attr.intent);
+               gfc_conv_aliased_arg (&parmse, e, f,
+                                     fsym ? fsym->attr.intent : INTENT_INOUT);
              else
                gfc_conv_array_parameter (&parmse, e, argss, f);

Paul 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28353


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]