public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/107952] tree-object-size: inconsistent size for flexible arrays nested in structs
Date: Thu, 26 Jan 2023 07:20:12 +0000	[thread overview]
Message-ID: <bug-107952-4-4kVDWv3ZRM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107952-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107952

--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Qing Zhao from comment #15)
> > On Jan 25, 2023, at 11:12 AM, siddhesh at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> wrote:
> >> 
> >>> The first is handled by the function just fine,
> >> 
> >> No, even the first case is not recognized by the current
> >> “array_ref_flexible_size_p”, it’s not been identified as a flexible array
> >> right now.
> >> Shall we include this case into “array_ref_flexible_size_p”?  (It’s a GCC
> >> extension).
> > 
> > In the first case, array_ref_flexible_size_p recognizes S2.flex.data as having
> > flexible size.  The tests in my patch[1] for this bug checks for this.
> Oh, yes. That’s right.
> > 
> > However, array_ref_flexible_size_p does not recognize S2.flex as having
> > flexible size.  It might make sense to support that, i.e. any struct or union
> > with the last element as a flex array should be recognized as having flexible
> > size.
> 
> Since S2.flex is not an “array_ref”, it’s correct for
> array_ref_fleixble_size_p to return false for it, I think. 

Yes, that's correct.

The routine is supposed to answer if an actual _access_ is to a flexible
size part.  The whole aggregate is not part of a flexible size part here.

tree-object-size usually wants to know if a pointer points to an object
with flexible size which is really something different and might not
share much with the logic in array_ref_fleixble_size_p

  parent reply	other threads:[~2023-01-26  7:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 14:04 [Bug tree-optimization/107952] New: " siddhesh at gcc dot gnu.org
2022-12-05  8:05 ` [Bug tree-optimization/107952] " rguenth at gcc dot gnu.org
2022-12-05 12:46 ` siddhesh at gcc dot gnu.org
2022-12-05 13:15 ` jakub at gcc dot gnu.org
2022-12-05 15:11 ` rguenther at suse dot de
2022-12-05 15:28 ` siddhesh at gcc dot gnu.org
2023-01-23 19:39 ` qinzhao at gcc dot gnu.org
2023-01-23 19:44 ` qinzhao at gcc dot gnu.org
2023-01-23 21:30 ` siddhesh at gcc dot gnu.org
2023-01-24 10:04 ` rguenth at gcc dot gnu.org
2023-01-24 15:24 ` qing.zhao at oracle dot com
2023-01-25  7:32 ` rguenther at suse dot de
2023-01-25 12:44 ` siddhesh at gcc dot gnu.org
2023-01-25 15:14 ` qing.zhao at oracle dot com
2023-01-25 16:12 ` siddhesh at gcc dot gnu.org
2023-01-25 16:40 ` qing.zhao at oracle dot com
2023-01-25 21:16 ` siddhesh at gcc dot gnu.org
2023-01-25 21:43 ` qinzhao at gcc dot gnu.org
2023-01-26  7:20 ` rguenth at gcc dot gnu.org [this message]
2023-01-26 22:13 ` qinzhao at gcc dot gnu.org
2023-01-27  7:46 ` rguenther at suse dot de

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=bug-107952-4-4kVDWv3ZRM@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).