Hello, Trying to debug another issue, I have found this ICE, trunk at r163595 [sfilippo@localhost bug22]$ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/local/gnu46/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/usr/local/gnu46 --enable-languages=c,c++,fortran : (reconfigured) ../gcc/configure --prefix=/usr/local/gnu46 --enable-languages=c,c++,fortran Thread model: posix gcc version 4.6.0 20100827 (experimental) (GCC) [sfilippo@localhost bug22]$ gfortran -ggdb -c bug22.f03 [sfilippo@localhost bug22]$ gfortran -ggdb -fcheck=pointer -c bug22.f03 bug22.f03: In function 'base_get_nz_row': bug22.f03:58:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 21581 [details] test case
Confirmed as a regression appearing between revisions 158215 and 158921, the seg fault is: Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000048 gfc_conv_procedure_call (se=0x7fff5fbfd6b0, sym=0x141921b10, arg=0x1419266f0, expr=0x0, append_args=0x0) at ../../work/gcc/fortran/trans-expr.c:3171 3171 if (attr->optional)
Here is a reduced test case: module base_mat_mod type :: base_sparse_mat contains procedure :: get_fmt end type contains function get_fmt(a) result(res) implicit none class(base_sparse_mat), intent(in) :: a character(len=5) :: res res = 'NULL' end function subroutine errlog(name) character(len=*) :: name end subroutine subroutine test (a) implicit none class(base_sparse_mat), intent(in) :: a call errlog(a%get_fmt()) end subroutine end module
Mine (have a patch).
Subject: Bug 45438 Author: janus Date: Mon Sep 20 21:42:54 2010 New Revision: 164462 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164462 Log: 2010-09-20 Janus Weil <janus@gcc.gnu.org> PR fortran/45438 * trans-expr.c (gfc_conv_procedure_call): Fix pointer checking for TBPs, PPCs and pointer/allocatable components. 2010-09-20 Janus Weil <janus@gcc.gnu.org> PR fortran/45438 * gfortran.dg/pointer_check_7.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/pointer_check_7.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog
Fixed with r164462. Closing.