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: PR middle-end/30017 (ICE in C++ size hook)


On 12/4/06, Mark Mitchell <mark@codesourcery.com> wrote:
Jan Hubicka wrote:

> There are several places in RTL's expand_assignment where explow's
> expr_size is queried. My patch triggers one of these.
> In fact only uses of the hook are the expr_size functions and those are
> used exclusively by assignment, initialization and function calling
> RTL expansion code.  So if we really can safely use TYPE_SIZE_UNIT here
> (ie inline lhd_expr_size implemntation from langhooks) we can also
> pretty well drop the hook entirely.

Yes, that is certainly where we need to get to: the expr_size hook is
clearly something that should be made explicit in the IL.

I agree, but ...


Until then, I'm not sure what to suggest.  Removing the asserts will
actually generate wrong code.  For this input:

__builtin_memcpy (a, b, sizeof (*a))

if "a" has type "C*", and "C" has virtual bases, then the C++ hook will
return the size of C *without virtual bases* which is wrong, since the
user said to copy the entire thing.  (This is what I mean by there being
no right answer.)  So, I think you have to disable the transformation
for C++, at least when the class in question has virtual bases.

... I fail to see how the above can create wrong code removing the asserts. Surely if sizeof (*a) can give multiple answers the above code will look different after gimplification, and the transformation to an assignment cannot happen because we don't know the size (I expect a conditional in the gimplified version).

So I don't think this case matters at all, all matters is that we get rid of
calling the expr_size hook at RTL expansion time.

Richard.


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