User account creation filtered due to spam.

Bug 54244 - [OOP] ICE in gfc_add_component_ref, at fortran/class.c:210
Summary: [OOP] ICE in gfc_add_component_ref, at fortran/class.c:210
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: janus
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2012-08-13 14:53 UTC by Sylwester Arabas
Modified: 2016-11-16 15:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-08-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sylwester Arabas 2012-08-13 14:53:17 UTC
With Deabian's gcc-snapshot gfortran (4.8.0 20120714) trying to compile to code
below:



module aqq_m
  type :: arr_t
  end type
  type :: aqq_t
    class(arr_t), allocatable :: psi(:)
    contains
    procedure :: aqq_init
  end type 
  contains
  subroutine aqq_init(this)
    class(aqq_t) :: this
  end subroutine
end module
program bug1
  use aqq_m
  class(aqq_t) :: aqq
  call aqq%aqq_init
end program



I get:



$ /usr/lib/gcc-snapshot/bin/gfortran -std=f2008 -ffree-form  bug1.f 
bug1.f:32.21:

  class(aqq_t) :: aqq
                     1   
Error: CLASS variable 'aqq' at (1) must be dummy, allocatable or pointer
bug1.f:33.10:

  call aqq%aqq_init
          1
Error: Type mismatch in argument 'this' at (1); passed CLASS(__class_aqq_m_Arr_t_1_0a) to CLASS(aqq_t)
f951: internal compiler error: in gfc_add_component_ref, at fortran/class.c:210
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.



HTH,
Sylwester
Comment 1 Tobias Burnus 2012-08-13 15:35:25 UTC
Fails in gfc_add_component_ref at
213       gcc_assert((*tail)->u.c.component);

Here, (*tail)->u.c.component == NULL and tail->u.c.sym->name == "aqq_t".

Called via resolve_typebound_subroutine.
Comment 2 janus 2012-08-15 21:46:27 UTC
For a fix, see PR 54243 comment 2 and 3.
Comment 3 janus 2012-08-15 22:11:13 UTC
Author: janus
Date: Wed Aug 15 22:11:03 2012
New Revision: 190420

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190420
Log:
2012-08-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54243
	PR fortran/54244
	* resolve.c (check_typebound_baseobject): Check for class_ok attribute.
	(resolve_procedure_interface,resolve_fl_derived0): Copy class_ok
	attribute.

2012-08-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54243
	PR fortran/54244
	* gfortran.dg/typebound_call_24.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_call_24.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 janus 2012-08-15 22:19:30 UTC
Fixed with r190420. Closing.
Comment 5 janus 2012-09-04 08:03:18 UTC
Author: janus
Date: Tue Sep  4 08:03:09 2012
New Revision: 190910

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190910
Log:
2012-09-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54435
	PR fortran/54443
	* match.c (gfc_match_select_type): Make sure to only access CLASS_DATA
	for BT_CLASS.

2012-09-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54243
	PR fortran/54244
	* gfortran.dg/select_type_29.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/select_type_29.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/testsuite/ChangeLog