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

--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> 2011-04-13 
10:37:29 UTC ---
Confirmed on fairly recent trunk:
GNU Fortran (GCC) 4.7.0 20110404 (experimental)

Reduced testcase:

!!!!!!!!!!!!!!!!!!!!
MODULE LA_PRECISION
IMPLICIT NONE
INTEGER, PARAMETER :: dp = KIND(1.0D0)
END MODULE LA_PRECISION

module lapack90
INTERFACE
  SUBROUTINE DGESV_F90( A, B, IPIV, INFO )
    USE la_precision, ONLY: wp => dp
    IMPLICIT NONE
    INTEGER, INTENT(OUT), OPTIONAL         :: INFO
    INTEGER, INTENT(OUT), OPTIONAL, TARGET :: IPIV(:)
    REAL(WP), INTENT(IN OUT)               :: A(:,:), B(:,:)
  END SUBROUTINE DGESV_F90
END INTERFACE
end module

SUBROUTINE DGESV_F90( A, B, IPIV, INFO )
  USE la_precision, ONLY: wp => dp
  IMPLICIT NONE
  INTEGER, INTENT(OUT), OPTIONAL         :: INFO
  INTEGER, INTENT(OUT), OPTIONAL, TARGET :: IPIV(:)
  REAL(WP), INTENT(IN OUT)               :: A(:,:), B(:,:)
END SUBROUTINE DGESV_F90



MODULE DENSEOP
  USE LAPACK90
  implicit none
  integer, parameter :: r8 = SELECTED_REAL_KIND( 15, 307 )
  real(r8)::denseop_tol=1.d-50

  CONTAINS

  SUBROUTINE GEINV8 (x)
   real(r8)::x(:,:)
   real(r8),allocatable::x_o(:,:)
   allocate(x_o(size(x,1),size(x,1)))
   CALL dgesv_f90(x,x_o)
   x=x_o
  END SUBROUTINE GEINV8
END MODULE DENSEOP
!!!!!!!!!!!!!!!!!!!

It looks like a AS_DEFERRED vs AS_ASSUMED_SHAPE problem. 

Program received signal SIGSEGV, Segmentation fault.
gfc_get_nodesc_array_type (etype=0x8018540a8, as=0x801a0d440, 
    packed=PACKED_FULL, restricted=1 '\001')
    at /home/mik/gcc46/src/gcc/fortran/trans-types.c:1444
1444          if (expr->expr_type == EXPR_CONSTANT)
(gdb) bt
#0  gfc_get_nodesc_array_type (etype=0x8018540a8, as=0x801a0d440, 
    packed=PACKED_FULL, restricted=1 '\001')
    at /home/mik/gcc46/src/gcc/fortran/trans-types.c:1444
#1  0x0000000000580482 in gfc_sym_type (sym=0x801a436c0)
    at /home/mik/gcc46/src/gcc/fortran/trans-types.c:2009
#2  0x0000000801a436c0 in ?? ()
#3  0x0000000801a90f70 in ?? ()
#4  0x0000000801a43500 in ?? ()
#5  0x0000000000000000 in ?? ()
(gdb) up
#1  0x0000000000580482 in gfc_sym_type (sym=0x801a436c0)
    at /home/mik/gcc46/src/gcc/fortran/trans-types.c:2009
2009              type = gfc_get_nodesc_array_type (type, sym->as,
(gdb) p sym.name
$4 = 0x801844f58 "a"
(gdb) p *sym.as
$5 = {rank = 2, corank = 0, type = AS_DEFERRED, cotype = 0, lower = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0}, upper = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, 
  cray_pointee = 0 '\0', cp_was_assumed = 0 '\0'}
(gdb) p sym.attr.dummy
$6 = 1

Reply via email to