From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 93F293853804 for ; Thu, 25 Aug 2022 18:28:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 93F293853804 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661452109; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=dWqGiaC/zPeFgRrSn6h5xVgSp1G1Q+tHUmMSHP1UmE0=; b=Aewlrz1vc4SOwDJr5RyG2LwFocarZFHlO1vWcvsIsoj19E2YPMZtJK7XHRZm+o5axd74Np e1Irz6VWSYV/74RW+Cyrcw/0wrSq6I53qGfOg7moCXwphOOnrrqlmVjAXu0wivuJRBmOHH HasTufn605JeR7X4CH73q0ryaYJwEMw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-x8OC0M5tNT-T7n_35OUDWg-1; Thu, 25 Aug 2022 14:28:27 -0400 X-MC-Unique: x8OC0M5tNT-T7n_35OUDWg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5DBA3802BB4; Thu, 25 Aug 2022 18:28:27 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 635F7492CA2; Thu, 25 Aug 2022 18:28:27 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 27PISO9Y2562310 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 20:28:24 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 27PISMoR2562309; Thu, 25 Aug 2022 20:28:22 +0200 Date: Thu, 25 Aug 2022 20:28:22 +0200 From: Jakub Jelinek To: Joseph Myers Cc: gcc-patches@gcc.gnu.org Subject: Re: c: Support C2x empty initializer braces Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Aug 25, 2022 at 05:33:02PM +0000, Joseph Myers wrote: > * gimplify.cc (gimplify_modify_expr): Convert initialization from > a variable-size CONSTRUCTOR to memset before call to > gimplify_modify_expr_rhs. > --- a/gcc/gimplify.cc > +++ b/gcc/gimplify.cc > @@ -6031,6 +6031,21 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, > return GS_ALL_DONE; > } > > + /* Convert initialization from an empty variable-size CONSTRUCTOR to > + memset. */ > + if (TREE_TYPE (*from_p) != error_mark_node > + && TYPE_SIZE_UNIT (TREE_TYPE (*from_p)) > + && !poly_int_tree_p (TYPE_SIZE_UNIT (TREE_TYPE (*from_p))) > + && TREE_CODE (*from_p) == CONSTRUCTOR > + && vec_safe_is_empty (CONSTRUCTOR_ELTS (*from_p))) Perhaps && CONSTRUCTOR_NELTS (*from_p) == 0) instead? > + { > + maybe_with_size_expr (from_p); The indentation above is 8 spaces instead of tab. > + gcc_assert (TREE_CODE (*from_p) == WITH_SIZE_EXPR); > + return gimplify_modify_expr_to_memset (expr_p, > + TREE_OPERAND (*from_p, 1), > + want_value, pre_p); > + } > + Otherwise LGTM. Jakub