This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] PR42888: [4.5 Regression] ICE in fold_convert_loc, at fold-const.c:2670
- From: Tobias Burnus <burnus at net-b dot de>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 31 Jan 2010 16:33:03 +0100
- Subject: Re: [Patch, Fortran] PR42888: [4.5 Regression] ICE in fold_convert_loc, at fold-const.c:2670
- References: <854832d41001300411ya86336ana4ab1d0db3208664@mail.gmail.com>
Janus Weil wrote:
> here is my fix for a regression which was introduced by one of my
> CLASS patches (allocation of CLASS variables). For technical reasons I
> had moved some code for setting up default initializers from
> resolution to translation stage. As the PR shows, this causes a couple
> of problems (see e.g. comments #9 and #13). So I'm moving the code
> back to resolve.c. I also had to make an addition to
> gfc_trans_class_assign, which takes care of memcpy'ing the default
> initializer into the CLASS container (which before was handled
> directly in gfc_trans_allocate).
>
Actually, why do you need a memcopy and cannot do a normal assignment?
For TYPE one gets:
{
struct t t.0;
t.0.x = -999;
*x = t.0;
}
whereas for CLASS one gets (with your patch):
{
struct t t.0;
t.0.x = -999;
(void) __builtin_memcpy ((void *) x.$data, (void *) &t.0, 4);
}
To my knowledge, using memcopy makes the alias analysis more difficult
and should thus be avoided.
Tobias