[Patch, Fortran, OOP] PR 47767: SELECT TYPE fails to execute correct TYPE IS block

Janus Weil janus@gcc.gnu.org
Thu Feb 17 14:21:00 GMT 2011


Hi all,

here is the fix for a wrong-code OOP problem, where the vtab symbols
would not be passed on correctly through modules with PRIVATE
declaration. The vtabs are basically meant to be 'global' symbols,
which are usually defined in the same module as the corresponding
derived type and should be available everywhere else.

Therefore, the fix for this PR was to make the vtabs and vtypes public
in every module they are found in, even if there is a PRIVATE
statement. To accomplish this, I constructed a new function
'gfc_check_symbol_access', which is a descendant of 'gfc_check_access'
and in addition checks the 'vtab' and 'vtype' attributes. This
function I could substitute for 'gfc_check_access' in most places
(which in turn could be made static, and renamed), except for a few,
where it's used in a different way.

The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2011-02-17  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/47767
	* gfortran.h (gfc_check_access): Removed prototype.
	(gfc_check_symbol_access): Added prototype.
	* module.c (gfc_check_access): Renamed to 'check_access', made static.
	(gfc_check_symbol_access): New function, basically a shortcut for
	'check_access'.
	(write_dt_extensions,write_symbol0,write_generic,write_symtree): Use
	'gfc_check_symbol_access'.
	(write_operator,write_module): Renamed 'gfc_check_access'.
	* resolve.c (resolve_fl_procedure,resolve_fl_derived,
	resolve_fl_namelist,resolve_symbol,resolve_fntype): Use
	'gfc_check_symbol_access'.

2011-02-17  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/47767
	* gfortran.dg/class_40.f03: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr47767_v2.diff
Type: application/octet-stream
Size: 9026 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110217/92af8b06/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: class_40.f03
Type: application/octet-stream
Size: 714 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110217/92af8b06/attachment-0001.obj>


More information about the Fortran mailing list