This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Converting mpz_t to different integer representations
Paul Thomas wrote:
Steve and Brooks,
I read PR29786 and must admit I'm confused at what you're trying
to do.
An equivalence group is turned into a union, which contains fields with
all manner of offsets and, potentially differnt types and kinds. Adding
initializers on top of this causes something of a complication because
the data can be interleaved but not overlap. There is then a choice as
to what to do:
(i) Make a structure with separate fields for every data value.
(ii) Write the initializer data out into an array that holds it in
native form and to use this as the initializer for an int8_t field that
spans the union.
I chose to do the latter on grounds, I thought at the time, of
simplicity :-) ...I also had the solution of PR18769 in mind because
(ii) is what I had already done towards it.
I think that, if we didn't also happen to have to do constant-folding of
TRANSFER, (i) would turn out to be a lot simpler. But we do, and once
we get that half-working, then (ii) looks like it should be relatively
straightforward too.
However, I still don't understand why you're trying to convert the mpz_t
constants into _host_ integer values and asking about what types are
available on the host, given that the host representation and the target
representation are likely to be different. It looks like to me that the
native_encode_expr() function from gcc/fold-const.c is more like what
you want, since it takes a value and produces the corresponding bytewise
representation on the target.
Meanwhile, weren't you making some comments about going to not have all
that much time to be working on gfortran bug-fixing after the first of
the year? :) If you'd like (and aren't in too much of a hurry with
this), I can poke some at translating the native_encode_expr stuff into
a gfortran equivalent.
- Brooks (with thanks to Andrew Pinski for pointing me at fold-const.c)