From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id B31FC385782E for ; Mon, 11 Oct 2021 14:22:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B31FC385782E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E63EA220BC for ; Mon, 11 Oct 2021 14:22:50 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D17C613BC0 for ; Mon, 11 Oct 2021 14:22:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SYT9MbpIZGGaMgAAMHmgww (envelope-from ) for ; Mon, 11 Oct 2021 14:22:50 +0000 Date: Mon, 11 Oct 2021 16:22:50 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/102683 - fix .DEFERRED_INIT expansion Message-ID: <3179q198-42rq-psp3-622-pop8p167n878@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2021 14:22:53 -0000 This avoids using an integer type for which we don't have an approprate mode when expanding .DEFERRED_INIT to a non-memory entity. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Will push after it finished. Richard. 2021-10-11 Richard Biener PR middle-end/102683 * internal-fn.c (expand_DEFERRED_INIT): Check for mode availability before building an integer type for storage purposes. --- gcc/internal-fn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index 6bc256832f7..b3638192fb9 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -3074,7 +3074,9 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt) tree init; if (tree_fits_uhwi_p (var_size) && (init_type == AUTO_INIT_PATTERN - || !is_gimple_reg_type (var_type))) + || !is_gimple_reg_type (var_type)) + && int_mode_for_size (tree_to_uhwi (var_size) * BITS_PER_UNIT, + 0).exists ()) { unsigned HOST_WIDE_INT total_bytes = tree_to_uhwi (var_size); unsigned char *buf = (unsigned char *) xmalloc (total_bytes); -- 2.31.1