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]

Re: [patch] fix wrong gimple code with ptr to forward vla


> I'm not happy with this heuristic.  

Olivier and I talked about this in person a couple of days ago and I'm
not either, but it seemed the best approach to us.

> Wouldn't the same bug occur if a typedef was used to give a name to the
> pointer type?  In any case, I can't see any intuitive reason for making
> anonymity have semantics in the middle end.  (It does have semantics in
> some languages, of course, so in the front end I would not have the same
> objection.)

The idea here is this:

In general, indeed one should not gimplify the sizes of the type pointed
to when the sizes of the pointer type are gimplified.  The reason for
this is incomplete types, as in this test case.

In most cases for most languages, each VLA type is in some TYPE_DECL and
the gimplification of that TYPE_DECL causes the sizes of that type to
be gimplified (in Ada this is true for *all* types, not just VLA types).
So the "proper" fix for this is to remove Jakub's patch and instead make
a patch for the C (and perhaps C++) front ends to make a TYPE_DECL for
that anonymous type and chain it accordingly.

However, if (and only if) the type is really anonymous and doesn't
have a TYPE_DECL, it's safe to gimplify its sizes when the thing that
points to it is gimplified.  This seemed the safest change to both of us
rather the rooting around and making a more complex change to the C front
end to replace the change for PR 21536.


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