[Patch, fortran] PR37274(regression), 36374 and 36454

Paul Richard Thomas paul.richard.thomas@gmail.com
Thu Sep 11 13:04:00 GMT 2008


This started out with the patch that I posted a week ago - primarily
for PR37274.  Tobias pointed out that the testcase in comment 4 should
be checked and.... well, one thing led to another:-)

I have been completely stuck on the passing of generic procedures as
actual arguments until I had the light-bulb moment this morning.  The
result can be seen in resolve.c.  I have introduced a function to
count the number of specific procedures with the same name as the
generic that is being passed as an actual argument.  If there is only
one, all is well, otherwise it is an error.

An additional wrinkle that took a while to sort out was obtaining
symbol attributes in read_module.  When symbols are scanned mio_symbol
is not invoked so the confirmation that the new symbol is generic is
not available.  This has been put right by reading the attribute
directly from the module.  Whilst this does slow up module reading a
bit, it does ensure that ambiguous symbols are picked up.

The fix for 36454 is fairly obvious but not so much so that the
standard watchers should not take a look at it.

Bootstrapped and regtested on FC8/x86_ia64 - OK for trunk?

Paul

2008-09-11  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/37274
	PR fortran/36374
	* module.c (check_for_ambiguous): New function to test loaded
	symbol for ambiguity with fixup symbol.
	(read_module): Call check_for_ambiguous.
	(write_symtree): Do not write the symtree for symbols coming
	from and interface body.

	PR fortran/36374
	* resolve.c (count_specific_procs ): New function to count the
	number of specific procedures with the same name as the generic
	and emit appropriate errors for and actual argument reference.
	(resolve_assumed_size_actual): Add new argument no_formal_args.
	Correct logic around passing generic procedures as arguments.
	Call count_specific_procs from two locations.
	(resolve_function): Evaluate and pass no_formal_args.
	(resolve call): The same and clean up a bit using csym more
	widly.

	PR fortran/36454
	* symbol.c (gfc_add_access): Access can be updated if use
	associated and not private.

2008-09-11  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/37274
	* gfortran.dg/used_types_22.f90: New test.
	* gfortran.dg/used_types_23.f90: New test.

	PR fortran/36374
	* gfortran.dg/generic_17.f90: New test.
	* gfortran.dg/ambiguous_specific_2.f90: New test.
	* gfortran.dg/generic_actual_arg.f90: Add test for case that is
	not ambiguous.

	PR fortran/36454
	* gfortran.dg/access_spec.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 24992 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080911/fe321ab6/attachment.bin>


More information about the Fortran mailing list