public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Qing Zhao <qing.zhao@oracle.com>
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>,
	Richard Biener <rguenther@suse.de>,
	"joseph@codesourcery.com" <joseph@codesourcery.com>,
	gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays.
Date: Thu, 1 Dec 2022 15:19:02 -0800	[thread overview]
Message-ID: <202212011518.5C7B46D21@keescook> (raw)
In-Reply-To: <7F963B56-040D-4384-B51B-3A63A3E38249@oracle.com>

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.

Okay, that seems good. Given that -Warray-bounds is part of -Wall, what
should happen for -Wstrict-flex-arrays=N?

-- 
Kees Cook

  reply	other threads:[~2022-12-01 23:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 14:25 [V2][PATCH 0/1]Add " Qing Zhao
2022-11-30 14:25 ` [V2][PATCH 1/1] Add " Qing Zhao
2022-12-01 16:42   ` Kees Cook
2022-12-01 17:04     ` Qing Zhao
2022-12-01 17:18       ` Kees Cook
2022-12-01 17:48         ` Qing Zhao
2022-12-01 19:45     ` Siddhesh Poyarekar
2022-12-01 22:27       ` Qing Zhao
2022-12-01 23:19         ` Kees Cook [this message]
2022-12-01 23:53           ` Siddhesh Poyarekar
2022-12-02  7:16       ` Richard Biener
2022-12-02  7:20         ` Richard Biener
2022-12-02 14:43           ` Qing Zhao
2022-12-05 15:16             ` Richard Biener
2022-12-05 15:20               ` Qing Zhao
2022-12-02 14:40         ` Qing Zhao
2022-12-06 16:14 [V3][PATCH 0/2]Update -Warray-bounds with -fstrict-flex-arrays Qing Zhao
2022-12-06 16:14 ` [V2][PATCH 1/1] Add a new warning option -Wstrict-flex-arrays Qing Zhao
2022-12-06 16:16   ` Qing Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202212011518.5C7B46D21@keescook \
    --to=keescook@chromium.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=qing.zhao@oracle.com \
    --cc=rguenther@suse.de \
    --cc=siddhesh@gotplt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).