Bug 45438 - [4.6 Regression] [OOP] ICE with -fcheck=pointer
Summary: [4.6 Regression] [OOP] ICE with -fcheck=pointer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: janus
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-08-28 09:03 UTC by Salvatore Filippone
Modified: 2010-09-20 21:44 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work: 4.5.2
Known to fail: 4.6.0
Last reconfirmed: 2010-09-20 17:41:21


Attachments
test case (555 bytes, text/plain)
2010-08-28 09:04 UTC, Salvatore Filippone
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Salvatore Filippone 2010-08-28 09:03:43 UTC
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.
Comment 1 Salvatore Filippone 2010-08-28 09:04:20 UTC
Created attachment 21581 [details]
test case
Comment 2 Dominique d'Humieres 2010-08-28 10:29:48 UTC
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)
Comment 3 janus 2010-09-20 16:29:46 UTC
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
Comment 4 janus 2010-09-20 17:41:21 UTC
Mine (have a patch).
Comment 5 janus 2010-09-20 21:43:14 UTC
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

Comment 6 janus 2010-09-20 21:44:25 UTC
Fixed with r164462. Closing.