This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [Patch, Fortran] PR42888: [4.5 Regression] ICE in fold_convert_loc, at fold-const.c:2670


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


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