From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 8A3E03858D1E for ; Wed, 21 Dec 2022 07:12:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A3E03858D1E Authentication-Results: sourceware.org; dmarc=pass (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-out1.suse.de (Postfix) with ESMTP id 6AC0722275; Wed, 21 Dec 2022 07:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1671606773; 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=SV3A9CwKU6WJOAJzbC8pDu3zSEi6F6p6zDNotEGpRVg=; b=jOAleBUnkIHGBJTiX+8erpsES25RYG39OGQrjt2G2MBgSykNMoUS2jFZUWu+uejoRV07yt /TJ5igAJcAhJRu4QfcaWDn2J8KMM1KMHpa0VjdUid9J04BQsjhQn48yWJpXkGkCZwsgXOf kSvajJaf+BCEQyE9aVKK+gt6tZj7U3Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1671606773; 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=SV3A9CwKU6WJOAJzbC8pDu3zSEi6F6p6zDNotEGpRVg=; b=yeD29QptUXiMq4xMhjF0jD5fUEd78Wm9VMnR0TR017h4+bYZndjej9dd/Qij5KHGw85zZz Dm7EZo9eCKF2aXDw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (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 60B262C141; Wed, 21 Dec 2022 07:12:53 +0000 (UTC) Date: Wed, 21 Dec 2022 07:12:53 +0000 (UTC) From: Richard Biener To: Qing Zhao cc: gcc Patches Subject: Re: gcc-13/changes.html: Mention -fstrict-flex-arrays and its impact In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 Tue, 20 Dec 2022, Qing Zhao wrote: > Hi, > > This is the patch for mentioning -fstrict-flex-arrays and -Warray-bounds=2 changes in gcc-13/changes.html. > > Let me know if you have any comment or suggestions. Some copy editing below > Thanks. > > Qing. > > ======================================= > From c022076169b4f1990b91f7daf4cc52c6c5535228 Mon Sep 17 00:00:00 2001 > From: Qing Zhao > Date: Tue, 20 Dec 2022 16:13:04 +0000 > Subject: [PATCH] gcc-13/changes: Mention -fstrict-flex-arrays and its impact. > > --- > htdocs/gcc-13/changes.html | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html > index 689178f9..47b3d40f 100644 > --- a/htdocs/gcc-13/changes.html > +++ b/htdocs/gcc-13/changes.html > @@ -39,6 +39,10 @@ a work-in-progress.

>
  • Legacy debug info compression option -gz=zlib-gnu was removed > and the option is ignored right now.
  • >
  • New debug info compression option value -gz=zstd has been added.
  • > +
  • -Warray-bounds=2 will no longer issue warnings for out of bounds > + accesses to trailing struct members of one-element array type anymore. Please > + add -fstrict-flex-arrays=level to control how the compiler treat > + trailing arrays of structures as flexible array members.
  • "Instead it diagnoses accesses to trailing arrays according to -fstrict-flex-arrays." > > > > @@ -409,6 +413,17 @@ a work-in-progress.

    >

    Other significant improvements

    > > > +

    Treating trailing arrays as flexible array members

    > + > +
      > +
    • GCC can now control when to treat the trailing array of a structure as a > + flexible array member for the purpose of accessing the elements of such > + an array. By default, all trailing arrays of structures are treated as all trailing arrays in aggregates are treated > + flexible array members. Use the new command-line option > + -fstrict-flex-array=level to control how GCC treats the trailing > + array of a structure as a flexible array member at different levels. -fstrict-flex-arrays to control which trailing array members are streated as flexible arrays. I've also just now noticed that there's now a flag_strict_flex_arrays check in the middle-end (in array bound diagnostics) but this option isn't streamed or handled with LTO. I think you want to replace that with the appropriate DECL_NOT_FLEXARRAY check. We might also want to see how inlining accesses from TUs with different -fstrict-flex-arrays setting behaves when accessing the same structure (and whether we might want to issue an ODR style diagnostic there). Thanks, Richard.