From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from beige.elm.relay.mailchannels.net (beige.elm.relay.mailchannels.net [23.83.212.16]) by sourceware.org (Postfix) with ESMTPS id BC53B3858D32 for ; Thu, 1 Dec 2022 23:53:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC53B3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 250856C0B85; Thu, 1 Dec 2022 23:53:06 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id A01756C0EB2; Thu, 1 Dec 2022 23:53:05 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1669938785; a=rsa-sha256; cv=none; b=hoKBKBpjNZY5m7DKjxSkbQ6P+e68q3L37hDr3FT/p0/Mg+s6bhMcCY9kIrmBNEDH+4QR8U l/rYxdPItFbXspjixSmHRfSbbsGnjnxxN+OsNyEJYIr/yb+cElrWu9SxlqJJI5sYEvxbfI t9h3xeviYDuSachPWtOuo6Y8fqjIGmyn8OY+NZtq/JUr6L4PqeoOib6dXTl0Org6+7PAMv gBeGGZiKdUC44ZJRjLXkyRQTl9Gkofag+KVSVGLqwbTon/hzIKPRm1sSXV7fitpTK59WjV gMzNhQ4AfUvNO7Pp7uucwEb7BCDphOIFIHi5k751HDDBiEYVfdoC7DUSjg5rdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1669938785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=V/Bq6UtBEPpEJbfwZaDtrFTW6xTdqhghhw7t4UKfFMg=; b=YUYzMVVlys3w83nUEJn9rNXevv85UAxMb4usdlWfxGM5MnHpn9Nd8D1JwqgOI9UXxS7bID pnng6tsfLFLjY0HISZHlE3UCCISmxwkckaI3hYVmAL4rCl0OgE9C2GLAYmX/aAzv/WVL+Q i9a+IoUq8YQi4cJmPGvcFJ9GOAKbNbIB22Z1H/r6ktHUriL3URIgib99s9xdGbylhwLoDA p2b5WUWKTHBnYIX2cTlOsKiir5pr8QUI29+78z8EooULSYedsc1YlMbY8UTb77EwmzBQP1 rppVoKtafOvOVo8fAuRKycUB2DVGA2gjVFhm8Too4/K7eem4Wzgik83Wg+px4Q== ARC-Authentication-Results: i=1; rspamd-7bd68c5946-vwsx5; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Arch-Vacuous: 23a1168376ccf134_1669938785921_1673629965 X-MC-Loop-Signature: 1669938785921:1909118663 X-MC-Ingress-Time: 1669938785921 Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.24.20 (trex/6.7.1); Thu, 01 Dec 2022 23:53:05 +0000 Received: from [192.168.0.182] (bras-base-toroon4834w-grc-23-76-68-24-147.dsl.bell.ca [76.68.24.147]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a306.dreamhost.com (Postfix) with ESMTPSA id 4NNXvN56jlzK1; Thu, 1 Dec 2022 15:53:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1669938785; bh=V/Bq6UtBEPpEJbfwZaDtrFTW6xTdqhghhw7t4UKfFMg=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=Fhab7RVaxHr/sOYGTdQmLk6fL7lcq8MjFJZdO6JizM1Z4XTNdbFCWqiQ7mfJsKTsV HHwzzfDulCMhVvmCLg7dOK9BpbSQBZ3rN06Xmnmi6yOEXGwmzRhlEG4M6VTgCDpriL pDGJSNXkMnwQ3LG4zS4lub9wlSUGB0YpBmyoVZXrt4Ka9BGfrrs9GVGquY74mHwihF 6ECt8RfPj6Y8uZvXoXOX5Fu8Nczy0d9w6nWQlaCI9B6cxzh8lBzv636IlQ2C1scmn7 P5P3UF7b4BzhML4m1tMZ9r4pC+0Ol4WlBuMb0l+lJ90RNzku4E4bBd5SWtbm406T9u xwzn/YBM6Ngug== Message-ID: Date: Thu, 1 Dec 2022 18:53:03 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays. Content-Language: en-US To: Kees Cook , Qing Zhao Cc: Richard Biener , "joseph@codesourcery.com" , gcc Patches References: <20221130142556.3079865-1-qing.zhao@oracle.com> <20221130142556.3079865-2-qing.zhao@oracle.com> <202212010840.C963E72661@keescook> <898dfeed-f392-fb86-7fbd-f99d335c7a64@gotplt.org> <7F963B56-040D-4384-B51B-3A63A3E38249@oracle.com> <202212011518.5C7B46D21@keescook> From: Siddhesh Poyarekar In-Reply-To: <202212011518.5C7B46D21@keescook> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3031.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP 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 2022-12-01 18:19, Kees Cook wrote: > On Thu, Dec 01, 2022 at 10:27:41PM +0000, Qing Zhao wrote: >> Hi, Sid, >> >> Thanks a lot for the input. >> >> After more thinking based on your and Kees’ comments, I have the following thought: >> >> 1. -fstrict-flex-arrays=level should control both GCC code gen and warnings consistently; >> 2. We need warnings specifically for -fstrict-flex-arrays=level to report any misuse of flexible >> array corresponding to the “level” to gradually encourage language standard. >> >> So, based on the above two, I think what I did in this current patch is correct: >> >> 1. We eliminate the control from -Warray-bounds=level on treating flex arrays, >> now only "-fstrict-flex-arrasy=level" controls how the warning treating the flex arrays. >> 2. We add a separate new warning -Wstrict-flex-arrays to report any misuse corresponding to >> the different level of -fstrict-flex-arrays. >> >> Although we can certainly merge these new warnings into -Warray-bounds, however, as Sid mentioned, >> -Warray-bounds does issue a lot more warnings than just flexible arrays misuse. I think it’s necessary >> To provide a seperate warning to only issue flexible array misuse. >> >> Let me know if you have any more comments on this. That's how I understood Richard's comment. > Okay, that seems good. Given that -Warray-bounds is part of -Wall, what > should happen for -Wstrict-flex-arrays=N? I suppose it would be independent of -Wall, dependent completely on -fstrict-flex-arrays. Thanks, Sid