https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102281

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to qinzhao from comment #7)
> I agree that the above additional check  is necessary.
> 
> one question here is, can I use the routine "bool
> clear_padding_type_may_have_padding_p (tree type)" in gimple-fold.c instead
> of the above new function for this purpose?

Sure, you can, but just note that it is conservative and fast, it will return
true even for types that don't have any padding.
But for double, _Complex double, int etc. it will quickly return false.
I guess I should use it in c-omp.c too.
But also note that it will return true for x86 long double/_Complex long
double,
and if you have a variable that isn't addressable, you need to figure out what
to do.  I think it might be easiest not to clear anything, another option is to
create a temporary, store the var value in there, clear padding and copy back,
but in the end the padding bits will probably not stay cleared.
After all, e.g. on x86-64 -m64 the return value will be either in %st or
%st/%st(1) pair and the padding isn't present there (but e.g. for ia32 _Complex
long double is returned through invisible reference and padding is there, but
you'd need to perform clear padding like operation during expansion).

Reply via email to