From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 9FF24385800F for ; Wed, 31 Aug 2022 19:29:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9FF24385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,278,1654588800"; d="scan'208";a="82341240" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 31 Aug 2022 11:29:18 -0800 IronPort-SDR: P1r1k0OYBBQUymAgcUgLaaEKw4FyVhoy9XM7DNxuf3bzqtF6AZ3CHmMSg4ze5bCGnqfTNprDZq m78TmxJoaFo6av7l6PI9ywJrliC3H3rWkq1yhm8SuUwsRPFWrzQZPibnEbEVkbYqH4SBIKV8hv VvyL7Y5fT086i6iH1LupcVnD7ogdowK0NntEyi4kpYUWirNd0+g3L1nYbxz/x1oHAgiLDx2I5u fP2NLQKSfa4jHcgeTYrldObGKhrq9OPL4U3kpBLuwfuC1jUxv9LSEkPo9f1LoFCsp34QN7V1OH yuc= Date: Wed, 31 Aug 2022 19:29:13 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Qing Zhao CC: jakub Jelinek , richard Biener , Kees Cook , 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 In-Reply-To: Message-ID: References: <20220817144042.2931674-1-qing.zhao@oracle.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-1152306461-1685795121-1661974153=:498823" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3111.4 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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: ---1152306461-1685795121-1661974153=:498823 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT On Wed, 31 Aug 2022, Qing Zhao via Gcc-patches wrote: > > How is level 3 (thus -fstrict-flex-array) interpreted when you specify > > -std=c89? How for -std=gnu89? > > 1. what’s the major difference between -std=c89 and -std=gnu89 on flexible array? (Checked online, cannot find a concrete answer on this). > ** my understanding is: -std=c89 will not support any flexible array (neither [], [0], [1]), but -std=gnu89 will support [0] and [1], but not []. > Is this correct? Flexible array members are supported in all C standard modes, since they don't affect the semantics of any valid pre-C99 program (only make valid programs that were previously erroneous). With -std=c89 or -std=gnu89, -pedantic will give a warning "ISO C90 does not support flexible array members" and -pedantic-errors will change that to an error. -- Joseph S. Myers joseph@codesourcery.com ---1152306461-1685795121-1661974153=:498823-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 9FF24385800F for ; Wed, 31 Aug 2022 19:29:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9FF24385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,278,1654588800"; d="scan'208";a="82341240" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 31 Aug 2022 11:29:18 -0800 IronPort-SDR: P1r1k0OYBBQUymAgcUgLaaEKw4FyVhoy9XM7DNxuf3bzqtF6AZ3CHmMSg4ze5bCGnqfTNprDZq m78TmxJoaFo6av7l6PI9ywJrliC3H3rWkq1yhm8SuUwsRPFWrzQZPibnEbEVkbYqH4SBIKV8hv VvyL7Y5fT086i6iH1LupcVnD7ogdowK0NntEyi4kpYUWirNd0+g3L1nYbxz/x1oHAgiLDx2I5u fP2NLQKSfa4jHcgeTYrldObGKhrq9OPL4U3kpBLuwfuC1jUxv9LSEkPo9f1LoFCsp34QN7V1OH yuc= Date: Wed, 31 Aug 2022 19:29:13 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Qing Zhao CC: jakub Jelinek , richard Biener , Kees Cook , 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 In-Reply-To: Message-ID: References: <20220817144042.2931674-1-qing.zhao@oracle.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3111.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 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: Wed, 31 Aug 2022 19:29:21 -0000 Message-ID: <20220831192913.GTf-fo9naRlxVYkvI-WbJZsfG3LoyOQC_FmAVBzM6bI@z> On Wed, 31 Aug 2022, Qing Zhao via Gcc-patches wrote: > > How is level 3 (thus -fstrict-flex-array) interpreted when you specify > > -std=c89? How for -std=gnu89? > > 1. what’s the major difference between -std=c89 and -std=gnu89 on flexible array? (Checked online, cannot find a concrete answer on this). > ** my understanding is: -std=c89 will not support any flexible array (neither [], [0], [1]), but -std=gnu89 will support [0] and [1], but not []. > Is this correct? Flexible array members are supported in all C standard modes, since they don't affect the semantics of any valid pre-C99 program (only make valid programs that were previously erroneous). With -std=c89 or -std=gnu89, -pedantic will give a warning "ISO C90 does not support flexible array members" and -pedantic-errors will change that to an error. -- Joseph S. Myers joseph@codesourcery.com