[patch, fortran] Fix PR42360 + some cleanup

Daniel Franke franke.daniel@gmail.com
Sat May 8 13:15:00 GMT 2010


Hi all.

This patch fixes a nuisance with warnings with derived type dummy arguments 
with INTENT(OUT) that are not set or default initialized.

Question is, if the updated warning in trans-decl.c (generate_local_decl) is 
now sufficient. It will only trigger if none of the components of the 
(possible nested) type in question has a default initializer. If there is an 
initializer three levels down, the warning is omitted. However, this 
corresponds to the behaviour if at least one component of the dummy argument 
is set in code.


gcc/fortran/:
2010-05-08  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/42360
	* gfortran.h (gfc_has_default_initializer): New.
	* expr.c (gfc_has_default_initializer): New.
	* resolve.c (has_default_initializer): Removed, use
	gfc_has_default_initializer() instead. Updated all callers.
	* trans-array.c (has_default_initializer): Removed, use
	gfc_has_default_initializer() instead. Updated all callers.
	* trans-decl.c (generate_local_decl): Do not check the
	first component only to check for initializers, but use
	gfc_has_default_initializer() instead.

gcc/testsuite/:
2010-05-08  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/42360
	* gfortran.dg/warn_intent_out_not_set.f90: New.


Regression tested on i686-pc-linux-gnu.
Ok for trunk?

	Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warn_intent_out_not_set.f90
Type: text/x-fortran
Size: 582 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100508/c2189131/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr42360.diff
Type: text/x-patch
Size: 6998 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100508/c2189131/attachment-0001.bin>


More information about the Gcc-patches mailing list