This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] PR29786 - [4.1/4.2/4.3 Regression] Initialization of overlapping variables: Not implemented


:ADDPATCH fortran:

This is also a fix for PR30875.

In order to deal with my previous two patches, I have had to clean out
my tree by submitting this one:)

Equivalence block members should be able to have initializers even if
the members overlap, as long as overlapping values are equal.  The
problem is that gfortran does not permit this, at present.

The fix works by detecting overlapping initializers, creating a new
unsigned char [] field for the equivalence union that is the size of
the union and writing all the initilizer values to this, using the
target-memory mechinery that was written for simplify_transfer.
Previously the constraints were wrongly applied and testcases have
been modified appropriately.  One new testcase is supplied.

Regtested on Cygwin_NT/PIV and, by tonight, on x86_ia64 - OK for trunk and 4.2?

Paul

PS Just for Tobias, I have changed the diff options:)

2007-05-24 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/29786
	PR fortran/30875
	* trans-common.c (get_init_field): New function.
	(create_common): Call get_init_field for overlapping
	initializers in equivalence blocks.
	* resolve.c (resolve_equivalence_derived, resolve_equivalence):
	Remove constraints on initializers in equivalence blocks.
	* target-memory.c (expr_to_char, gfc_merge_initializers):
	New functions.
	* target-memory.h : Add prototype for gfc_merge_initializers.

2007-05-24 Paul Thomas <pault@gcc.gnu.org>

	PR fortran/29786
	* gfortran.dg/equiv_7.f90: New test.
	* gfortran.dg/equiv_constraint_7.f90: Change error message.

	PR fortran/30875
	* gfortran.dg/equiv_constraint_5.f90: Correct code and error.

Attachment: pr29786_0524.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]