[Patch, Fortran, OOP] PR 47745: Segfault with CLASS(*) and derived type dummy arguments
Janus Weil
janus@gcc.gnu.org
Tue Feb 15 21:16:00 GMT 2011
Hi all,
we keep getting quite a number of ice-on-invalid PRs with OOP code
lately. Here is another one. The patch basically does accomplish three
tasks:
1) It rejects unlimited polymorphism, i.e. "CLASS(*)", with a clearer
error message (cf. the hunk in gfc_match_decl_type_spec). Previously
one would just get something about an "Invalid character in name".
2) It fixes the ICE on CLASS-valued functions without pointer or
allocatable attribute (by checking the 'class_ok' attribute, cf. hunks
in interface.c and primary.c).
3) It cleans up a regression of item #2 by moving the setting of the
'class_ok' attribute into 'gfc_build_class_symbol', to make sure it
will not be skipped.
Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
Cheers,
Janus
2011-02-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/47745
* class.c (gfc_build_class_symbol): Set 'class_ok' attribute.
* decl.c (build_sym,attr_decl1): Move setting of 'class_ok' into
'gfc_build_class_symbol'.
(gfc_match_decl_type_spec): Reject unlimited polymorphism.
* interface.c (matching_typebound_op): Check for 'class_ok' attribute.
* match.c (select_type_set_tmp): Move setting of 'class_ok' into
'gfc_build_class_symbol'.
* primary.c (gfc_variable_attr): Check for 'class_ok' attribute.
2011-02-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/47745
* gfortran.dg/class_39.f03: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr47745.diff
Type: application/octet-stream
Size: 3886 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110215/dd042f77/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: class_39.f03
Type: application/octet-stream
Size: 379 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110215/dd042f77/attachment-0001.obj>
More information about the Fortran
mailing list