Bug 49417 - [4.6 Regression] [OOP] ICE on invalid CLASS component declaration
[4.6 Regression] [OOP] ICE on invalid CLASS component declaration
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
unknown
: P3 normal
: 4.6.1
Assigned To: janus
: ice-on-invalid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-15 09:40 UTC by janus
Modified: 2011-06-19 21:21 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-06-15 11:56:15


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2011-06-15 09:40:05 UTC
Reported by Andrew Benson at http://gcc.gnu.org/ml/fortran/2011-06/msg00119.html:


module Nodes

 type :: nodeWrapper
 end type nodeWrapper

 type, extends(nodeWrapper) :: treeNode
    class(nodeWrapper) :: subComponent
 end type treeNode

end module Nodes


ICEs with 4.6 and 4.7 trunk, while it is correctly rejected with 4.5.
Comment 1 Tobias Burnus 2011-06-15 10:15:25 UTC
==15300== Invalid read of size 1
==15300==    at 0x502B83: parse_spec (parse.c:2110)
==15300==    by 0x503B42: gfc_parse_file (parse.c:4113)
==15300==    by 0x53D3F5: gfc_be_parse_file (f95-lang.c:250)

Which is parse_derived's (!)
2109         default:
2110           unexpected_statement (st);
Comment 2 janus 2011-06-15 11:56:15 UTC
Mine (I'm working on a patch). Apparently we fail to check for the 'class_ok' attribute.
Comment 3 janus 2011-06-16 11:45:09 UTC
Author: janus
Date: Thu Jun 16 11:45:05 2011
New Revision: 175101

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175101
Log:
2011-06-16  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49417
	* module.c (mio_component): Make sure the 'class_ok' attribute is set
	for use-associated CLASS components.
	* parse.c (parse_derived): Check for 'class_ok' attribute.
	* resolve.c (resolve_fl_derived): Ditto.

2011-06-16  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49417
	* gfortran.dg/class_43.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/class_43.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2011-06-18 17:12:50 UTC
Fixed for the trunk I assume.  Janus, if you want this to make into gcc 4.6.1-rc1, please commit on Monday or earlier.
Comment 5 janus 2011-06-19 21:05:22 UTC
Author: janus
Date: Sun Jun 19 21:05:18 2011
New Revision: 175194

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175194
Log:
2011-06-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/47601
	* module.c (mio_component_ref): Handle components of extended types.
	* symbol.c (gfc_find_component): Return if sym is NULL.

	PR fortran/48699
	* check.c (gfc_check_move_alloc): If 'TO' argument is polymorphic,
	make sure the vtab is present.

	PR fortran/49074
	* interface.c (gfc_extend_assign): Propagate the locus from the
	assignment to the type-bound procedure call.

	PR fortran/49417
	* module.c (mio_component): Make sure the 'class_ok' attribute is set
	for use-associated CLASS components.
	* parse.c (parse_derived): Check for 'class_ok' attribute.
	* resolve.c (resolve_fl_derived): Ditto.


2011-06-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/47601
	* gfortran.dg/extends_13.f03: New.

	PR fortran/48699
	* gfortran.dg/move_alloc_5.f90: New.

	PR fortran/49074
	* gfortran.dg/typebound_assignment_3.f03: New.

	PR fortran/49417
	* gfortran.dg/class_43.f03: New.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/class_43.f03
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/extends_13.f03
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/move_alloc_5.f90
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/typebound_assignment_3.f03
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/check.c
    branches/gcc-4_6-branch/gcc/fortran/interface.c
    branches/gcc-4_6-branch/gcc/fortran/module.c
    branches/gcc-4_6-branch/gcc/fortran/parse.c
    branches/gcc-4_6-branch/gcc/fortran/resolve.c
    branches/gcc-4_6-branch/gcc/fortran/symbol.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 6 janus 2011-06-19 21:21:24 UTC
Fixed on trunk and 4.6. Closing.