[patch, fortran] PR31473 - no error on duplicate EXTERNAL or INTRINSIC declarations

Daniel Franke franke.daniel@gmail.com
Sat Jun 16 19:09:00 GMT 2007


Attached patch emits an errors for duplicate external and intrinsic 
declarations as in the following code:

$> cat pr31473.f90
EXTERNAL foo
EXTERNAL foo
INTRINSIC abs
INTRINSIC abs
END

Due to this comment from the end of symbol.c (gfc_copy_attr) ...

  /* The subroutines that set these bits also cause flavors to be set,
     and that has already happened in the original, so don't let it
     happen again.  */

... I present two fixes to choose from. The first version (pr31473.patch) 
assumes this comment to be still valid, the second and more elegant 
(pr31473-2.patch) assumes that it is not.

I believe the latter to be true as I was not able to determine where this 
flavour-setting is supposed to happen: the function gfc_add_external() calls 
check_used(), check_conflict() and duplicate_attr() to report an error if 
any. Neither of the check_* functions seems to have the side-effect as stated 
by the comment. Both patches were regression tested on i686-pc-linux-gnu 
without issues.


:ADDPATCH fortran:
2007-06-16  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/31473
	* symbol.c (gfc_copy_attr): Emit errors for duplicate 
	EXTERNAL/INTRINSIC statements.


OK to apply either patch to trunk?

Regards
	Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31473-2.patch
Type: text/x-diff
Size: 743 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070616/0a653519/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31473.patch
Type: text/x-diff
Size: 711 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070616/0a653519/attachment-0001.bin>


More information about the Fortran mailing list