From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 406683858C55 for ; Wed, 31 Aug 2022 22:17:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 406683858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-x531.google.com with SMTP id 78so1193977pgb.13 for ; Wed, 31 Aug 2022 15:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc; bh=M1qeyv7krFrnL1j0CMueoxUP70eoyEUWAvwDGNPqtN4=; b=E1DSTFmbnRA146weXsUFLiZYDHKAUggCbJhXShg6Y2M02WIYUwMXFqq7YLO9xpYE8w 49A81Diux8PCaGll1sJxXjo9kvuygawDbaFwUYchL7r9Y3P0sw8giUmGWwEATvdoVigx MuA9nrlRpSQ1h/oM1IyxLdtTLxT3W2YxBeQeE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=M1qeyv7krFrnL1j0CMueoxUP70eoyEUWAvwDGNPqtN4=; b=FzdVsDP7IN43w/e+XH1XZXvVTNIENyvIMHpFcnug+tbUUqW/8omi6+uzxT/adifCNO yhHk9R8CjqQ1DmFriWDnOnOyHgJakRzYEzgGHdiCRS2dRDjUg/wQEyC+Jlq9extdmbRF zrxvQT5/koXRrynmrdiFWaH9rJjFYYqCAPGQspatzTNkf8OJI+S6yzg87cfVDAXMlS6M oPMNq5Pn6c+QVtFD53gJToUe4l+CauyjJiIR+O6ED6L+gkPGDJt71f6YA0EN02G+d6Aa BbOG649XH3YdUuwY99+oUpD7f75j6c2PLVydmBrJoyEPWkjRNgeKktCV/iXwrokt+F6D 34tw== X-Gm-Message-State: ACgBeo2Y/4BcZoL7lRk8Oz7DjNlvYOfwJSMItlh6x1Md+3nB/MZgafzj /cDsI4E2NITeyBbNimlaTb/kTA== X-Google-Smtp-Source: AA6agR7GQ523C+Pdla4swenfwlKqzmRBEKWb3kJP0QqMrKgwS4uQaajq0/frxH/I6VhBteUJ01nwlQ== X-Received: by 2002:a63:2:0:b0:42f:6169:f396 with SMTP id 2-20020a630002000000b0042f6169f396mr7452875pga.249.1661984224307; Wed, 31 Aug 2022 15:17:04 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id p10-20020a170902e74a00b0016d5b7fb02esm6243427plf.60.2022.08.31.15.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 15:17:03 -0700 (PDT) Date: Wed, 31 Aug 2022 15:17:01 -0700 From: Kees Cook To: Qing Zhao Cc: Joseph Myers , Richard Biener , jakub Jelinek , gcc Patches , Nathan Sidwell , martin Sebor Subject: Re: [[GCC13][Patch][V3] 1/2] Add a new option -fstrict-flex-array[=n] and new attribute strict_flex_array Message-ID: <202208311505.5B794D17C@keescook> References: <2C0B6A60-A27D-4B96-9559-096712EC32FA@oracle.com> <6A951E15-051F-4DBB-97B0-F51DF1E0F7D6@oracle.com> <792FF180-4337-41BD-81BE-D695CD2623CE@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <792FF180-4337-41BD-81BE-D695CD2623CE@oracle.com> X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Aug 31, 2022 at 08:16:49PM +0000, Qing Zhao wrote: > > > On Aug 31, 2022, at 4:09 PM, Joseph Myers wrote: > > > > On Wed, 31 Aug 2022, Qing Zhao wrote: > > > >>>> When -std=gnu89 + -fstrict-flex-array=3 (ONLY C99 flexible array member > >>>> [] is treated as a valid flexible array) present together, > >>> > >>> That seems reasonable enough without a warning. If people want a warning > >>> for flexible array members in older language modes, they can use > >>> -pedantic; I don't think we need to warn for any particular > >>> -fstrict-flex-array modes there. > >> > >> So, you mean, > >> > >> 1. GCC with -std=gnu89 support all [0], [1], and [] as Flexible array member; > >> 2. Therefore. -std=gnu89 + -fstrict-flex-array=3 does not need a warning; > >> > >> ? > > > > Yes. > > > >> Then, how about: > >> > >> -std=c89: > >> > >> 1. GCC with -std=c89 also support all [0], [1], and [] as Flexible array member; > >> 2, therefore, -std=c89 + -fstrict-flex-array does not need a warning too. > >> > >> ? > > > > Yes. > > > > Okay, I am fine with this. > > Richard and Kees, what’s your opinion on this? Agreed: I think it's fine not to warn about these "conflicting" flags in those cases. It looks like the C standard warnings about flexible arrays are already hidden behind -Wpedantic, so nothing else is needed, IMO. Using -fstrict-flex-arrays just enforces that warning. ;) -- Kees Cook