------- Comment #3 from pault at gcc dot gnu dot org 2007-01-12 06:00 ------- The attached bootstraps and regtests on IA64/FC5 - it even fixes the bug, as the testcase shows. (I will have to do the attaching a bit later - whatever I try with cookies does not seem to work right now.)
The patch works by checking for overlapping equivalence members with initializers, which gfc already did; on detecting such overlaps, a new char* field is created that spans the entire union. The equivalence group is then scanned for initializers, which are then byte-wize converted to char* (Note that this is half the job of simplify_array_transfer:) ). The char* in it's turn is converted into a tree-ssa vector constructor, which becomes the only initializer for the union. Another approach to this would have been to create a structure field, with components corresponding to the non-null, non-overlapping constructors. I did not do this on grounds of simplicity. The patch does not implement overlapping derived types with initializers; it could be done without too much trouble and probably should be, in spite of all the gotcha's that are involved in putting derived types in equivalences. The part of the patch that is giving me pause is the conversion of integers; because gmp does not offer a mpz_t to signed long long, I used the conversion in tree-const.c and write from two longs. These have to be ordered according to endian-ness. Could somebody advise on how to do this, please? Paul -- pault at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2006-11-09 20:14:18 |2007-01-12 06:00:50 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29786