From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 9E592385701E for ; Tue, 8 Jun 2021 07:41:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E592385701E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AFFA91FD4F; Tue, 8 Jun 2021 07:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623138098; h=from:from:reply-to: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=cmYSaEbiONF+0M3xpJj253VlRK/CJ6qyqGl1pwS1xQc=; b=RNLLt9UKb/2y74g+w5n3+q38OqyFifzQYtkQLbhxXIKJY6Mfv6ILtCs5AVc7vWhskGUa6N CcNFMUOSzjSfOZFvA9U5iXLS6POIfbl+Srr7ZFs4XwILMWtnsVvaMncMgOskPl4keMzn87 B/OqHmpoUAhSFMP+PpB39BnFt6vmpqI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623138098; h=from:from:reply-to: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=cmYSaEbiONF+0M3xpJj253VlRK/CJ6qyqGl1pwS1xQc=; b=TUSc6O87vbewsRhQ+/GNEEdssShCoOpA6UuZpCSDbzDpbeO37Pjga25xTCaXM3F+KkHjQ5 Dd8lOAb7aJSST6AQ== Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B5A92A3B84; Tue, 8 Jun 2021 07:41:38 +0000 (UTC) Date: Tue, 8 Jun 2021 09:41:38 +0200 (CEST) From: Richard Biener To: Qing Zhao cc: Kees cook , richard Sandiford , gcc-patches Qing Zhao via Subject: Re: [PATCH][version 3]add -ftrivial-auto-var-init and variable attribute "uninitialized" to gcc In-Reply-To: Message-ID: References: <52959802-6AF1-4BFC-B984-3BC495C535BD@ORACLE.COM> <720A8309-1964-4861-BE1C-7F7E1EB9FE18@oracle.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Tue, 08 Jun 2021 07:41:40 -0000 On Mon, 7 Jun 2021, Qing Zhao wrote: > Hi, > > > On Jun 7, 2021, at 2:53 AM, Richard Biener wrote: > > > >> > >> To address the above suggestion: > >> > >> My study shows: the call to __builtin_clear_padding is expanded during gimplification phase. > >> And there is no __bultin_clear_padding expanding during rtx expanding phase. > >> However, for -ftrivial-auto-var-init, padding initialization should be done both in gimplification phase and rtx expanding phase. > >> since the __builtin_clear_padding might not be good for rtx expanding, reusing __builtin_clear_padding might not work. > >> > >> Let me know if you have any more comments on this. > > > > Yes, I didn't suggest to literally emit calls to __builtin_clear_padding > > but instead to leverage the lowering code, more specifically share the > > code that figures _what_ is to be initialized (where the padding is) > > and eventually the actual code generation pieces. That might need some > > refactoring but the code where padding resides should be present only > > a single time (since it's quite complex). > > Okay, I see your point here. > > > > > Which is also why I suggested to split out the padding initialization > > bits to a separate patch (and option). > > Personally, I am okay with splitting padding initialization from this current patch, > Kees, what’s your opinion on this? i.e, the current -ftrivial-auto-var-init will NOT initialize padding, we will add another option to > Explicitly initialize padding. It would also be possible to have -fauto-var-init, -fauto-var-init-padding and have -ftrivial-auto-var-init for clang compatibility enabling both. Or -fauto-var-init={zero,pattern,padding} and allow -fauto-var-init=pattern,padding to be specified. Note there's also padding between auto variables on the stack - that "trailing" padding isn't initialized either? (yes, GCC sorts variables to minimize that padding) For example for void foo() { char a[3]; bar (a); } there's 12 bytes padding after 'a', shouldn't we initialize that? If not, why's other padding important to be initialized? Richard.