Bug 44962 - [OOP] ICE with specification expression SIZE(<CLASS>)
Summary: [OOP] ICE with specification expression SIZE(<CLASS>)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: janus
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2010-07-16 08:50 UTC by Tobias Burnus
Modified: 2010-07-29 21:01 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-07-18 16:17:11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2010-07-16 08:50:43 UTC
Reported by bd satish at http://gcc.gnu.org/ml/fortran/2010-07/msg00206.html

The following program segfaults. The crucial part is that the argument has is CLASS and not TYPE - and that it is used in a specification expression.

The ICE occurs when it is written to the .MOD file.


Valgrind shows:

==15819== Invalid read of size 8
==15819==    at 0x50E636: mio_expr (module.c:3091)
==15819==    by 0x50F0C9: mio_array_spec (module.c:2179)
==15819==    by 0x50F208: mio_component (module.c:2371)
==15819==    by 0x50F3E7: mio_symbol (module.c:2420)
==15819==    by 0x50F82A: write_symbol (module.c:4804)
==15819==    by 0x510CE5: write_symbol0 (module.c:4844)
==15819==    by 0x51132B: gfc_dump_module (module.c:5022)
==15819==    by 0x51BFE0: gfc_parse_file (parse.c:4388)


module array
  type :: t_array
     real, dimension(10) :: coeff
   contains
     procedure, nopass :: get_coeff
  end type t_array
contains
  function get_coeff(self) result(coeff)
    class(t_array), intent(in) :: self
    real, dimension(5) :: coeff
    i = size(self%coeff)
  end function get_coeff
end module array
Comment 1 janus 2010-07-29 20:59:14 UTC
Subject: Bug 44962

Author: janus
Date: Thu Jul 29 20:58:57 2010
New Revision: 162695

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162695
Log:
2010-07-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44962
	* resolve.c (resolve_fl_derived): Call gfc_resolve_array_spec.


2010-07-29  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44962
	* gfortran.dg/typebound_proc_17.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_proc_17.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog

Comment 2 janus 2010-07-29 21:01:12 UTC
Fixed with r162695. Closing.