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

--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The TARGET_EXPR is elided in gimplify_modify_expr_rhs:
        case TARGET_EXPR:
          {
            /* If we are initializing something from a TARGET_EXPR, strip the
               TARGET_EXPR and initialize it directly, if possible.  This can't
               be done if the initializer is void, since that implies that the
               temporary is set in some non-trivial way.

               ??? What about code that pulls out the temp and uses it
               elsewhere? I think that such code never uses the TARGET_EXPR as
               an initializer.  If I'm wrong, we'll die because the temp won't
               have any RTL.  In that case, I guess we'll need to replace
               references somehow.  */
            tree init = TARGET_EXPR_INITIAL (*from_p);

            if (init
                && (TREE_CODE (*expr_p) != MODIFY_EXPR
                    || !TARGET_EXPR_NO_ELIDE (*from_p))
                && !VOID_TYPE_P (TREE_TYPE (init)))
              {
                *from_p = init;
                ret = GS_OK;
                changed = true;
              }
          }
          break;

Though, can the TARGET_EXPR be elided if there are PLACEHOLDER_EXPRs in it?
If not, something should probably set TARGET_EXPR_NO_ELIDE somewhere.
If yes, perhaps we need to replace_placeholders perhaps through a language hook
at the
above point.  But it is unclear to what it should be replaced...

Reply via email to