[Patch, Fortran] PR 42545: type extension: parent component has wrong accessibility

Janus Weil janus@gcc.gnu.org
Mon Jan 18 21:10:00 GMT 2010


Hi all,

here is my patch for a couple of problems related to type extension
and component accessibility. For a detailed description see the PR.

My patch does two things:

1) It sets the correct accessibility for the parent component of an
extended type. Quoting the F03 standard, chapter 4.5.6.1:
"An extended type has a scalar, nonpointer, nonallocatable, parent component
with the type and type parameters of the parent type. The name of this
component is the parent type name. It has the accessibility of the parent
type."

2) It corrects an error message in gfc_find_component, which was
talking about structure constructors in places where there are none.
This error message is being merged with another one, which at the same
time is being corrected for parent components (whose access. rules are
a bit different from 'normal' components, as shown above).

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

Cheers,
Janus


gcc/fortran/
2010-01-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42545
	* resolve.c (resolve_fl_derived): Set the accessibility of the parent
	component for extended types.
	* symbol.c (gfc_find_component): Remove a wrongly-worded error message
	and take care of parent component accessibility.

gcc/testsuite/
2010-01-18  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42545
	* gfortran.dg/extends_6.f03: Modified an error message.
	* gfortran.dg/extends_10.f03: New test.
	* gfortran.dg/private_type_6.f03: Modified an error message.
	* gfortran.dg/structure_constructor_8.f03: Ditto.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr42545.diff
Type: application/octet-stream
Size: 3731 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100118/3287635e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extends_10.f03
Type: application/octet-stream
Size: 607 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100118/3287635e/attachment-0001.obj>


More information about the Gcc-patches mailing list