https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586
--- Comment #9 from Qing Zhao <qing.zhao at oracle dot com> --- > On Jul 23, 2021, at 10:34 AM, jakub at gcc dot gnu.org > <gcc-bugzi...@gcc.gnu.org> wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586 > > --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > (In reply to Qing Zhao from comment #7) >> So, is such type information generated by C++FE correct? > > Yes. It is needed that way to follow the Itanium C++ ABI. Okay. I see. Then with such type info, can clear_type_padding fill all the paddings for such type? > >>> BTW, if you are using the clear padding code for -ftrivial*, unless it is >>> clear_type_padding_in_mask, it can error e.g. on flexible array members, >>> which >>> is fine for the builtin, but probably not fine for -ftrivial*. >> >> I noticed this, and then I fixed this by adding a third argument for >> __builtin_clear_padding to indicate whether it’s for auto init or not. >> If for auto init, then not emit the error, is this fix good? >> >> (BTW, what’s clear_type_padding_in_mask try to do? Should I use it instead?) > > I'd need to see a patch. Do you want me send my current patch to you for some comments for this part? Then I can email to you with a separate email. > The builtin itself has a single argument and > shouldn't accept more than one, gimple_fold_builtin_clear_padding has also > just > a single argument. Currently, in gimplification phase, we already added one more argument to this call: (gimplify.c) ==== case BUILT_IN_CLEAR_PADDING: if (call_expr_nargs (*expr_p) == 1) { /* Remember the original type of the argument in an internal dummy second argument, as in GIMPLE pointer conversions are useless. */ p = CALL_EXPR_ARG (*expr_p, 0); *expr_p = build_call_expr_loc (EXPR_LOCATION (*expr_p), fndecl, 2, p, build_zero_cst (TREE_TYPE (p))); return GS_OK; ===== So, I just added one more argument in the above to distinguish the auto init. > clear_type_padding_in_mask doesn't emit code to clear any > memory, but fills in an array with bitmask which bits contain padding and > which > don't. > > -- > You are receiving this mail because: > You reported the bug.