[patch, fortran] PR41807 [4.5/4.4 Regression] data statement with nested type constructors

Jerry DeLisle jvdelisle@verizon.net
Sun Nov 22 13:15:00 GMT 2009


Hi,

This patch fixes this bug by removing an error check in resolve.c that uses 
gfc_is_constant_expr.  This function performs an expansion of the constructors, 
evidently too soon, causing the regression by modifying the expressions.

Obviously, these constructors do get properly expanded later.  Perhaps it should 
be renamed a bit to reflect this, maybe gfc_expand_is_constant_expr.

Regardless, after removing this function from next_data_value and running the 
testsuite I observed that the only failure was in data_value_1.f90.  The failure 
is an assert in trans-const.c (gfc_convert_const).  This seemed like the natural 
place to verify that each array element is actually a constant.

Thus I replaced the assert with the check for BT_CONSTANT, rewording the error 
message to be more general. The test case data_value_1.f90 is revised to reflect 
the new error message. A new test case, originally from Steve Kargl is also 
attached.

Regression tested on x86-64-gnu-linux.

OK for trunk?

Regards,

Jerry

2009-11-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* trans-const.c (gfc_conv_const): Fix typo in comment. Replace assert
	with error message if not constant.
	* resolve.c (next_data_value): Delete check for constant.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr41807.diff
Type: text/x-patch
Size: 2107 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091122/2cc6c196/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array_constructor_32.f90
Type: text/x-fortran
Size: 619 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091122/2cc6c196/attachment-0001.bin>


More information about the Fortran mailing list