public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101836] New: __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails
@ 2021-08-09 23:25 kees at outflux dot net
  2021-08-09 23:34 ` [Bug c/101836] " pinskia at gcc dot gnu.org
                   ` (44 more replies)
  0 siblings, 45 replies; 46+ messages in thread
From: kees at outflux dot net @ 2021-08-09 23:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101836
           Summary: __builtin_object_size(P->M, 1) where M is an array and
                    the last member of a struct fails
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kees at outflux dot net
  Target Milestone: ---

Created attachment 51282
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51282&action=edit
struct layout changes bos1 behavior

When bos1 is used on a member who is both an array and at the end of a
structure, it fails to correctly resolve. This kind of behavior should only
happen for flexible array members:

struct trailing_array {
    int a;
    int b;
    unsigned char c[16];
};

struct middle_array {
    int a;
    unsigned char c[16];
    int b;
};

ok:  sizeof(*working) == 24
ok:  sizeof(working->c) == 16
ok:  __builtin_object_size(working, 1) == -1
ok:  __builtin_object_size(working->c, 1) == 16
ok:  sizeof(*broken) == 24
ok:  sizeof(broken->c) == 16
ok:  __builtin_object_size(broken, 1) == -1
WAT: __builtin_object_size(broken->c, 1) == -1 (expected 16)

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2023-06-21 19:47 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 23:25 [Bug c/101836] New: __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails kees at outflux dot net
2021-08-09 23:34 ` [Bug c/101836] " pinskia at gcc dot gnu.org
2021-08-09 23:35 ` pinskia at gcc dot gnu.org
2021-08-10  1:19 ` kees at outflux dot net
2021-10-13  2:11 ` msebor at gcc dot gnu.org
2021-10-13  2:11 ` [Bug middle-end/101836] " msebor at gcc dot gnu.org
2021-10-13  3:11 ` siddhesh at gotplt dot org
2022-05-26 16:34 ` qinzhao at gcc dot gnu.org
2022-05-27  1:45 ` siddhesh at gcc dot gnu.org
2022-05-27 14:27 ` qinzhao at gcc dot gnu.org
2022-05-27 21:01 ` kees at outflux dot net
2022-05-27 21:08 ` kees at outflux dot net
2022-05-27 21:15 ` kees at outflux dot net
2022-06-08 14:09 ` qinzhao at gcc dot gnu.org
2022-06-08 15:37 ` kees at outflux dot net
2022-06-08 16:06 ` qinzhao at gcc dot gnu.org
2022-06-10 20:15 ` qinzhao at gcc dot gnu.org
2022-06-10 20:24 ` qinzhao at gcc dot gnu.org
2022-06-11  8:21 ` kees at outflux dot net
2022-06-13 14:48 ` msebor at gcc dot gnu.org
2022-06-13 18:12 ` kees at outflux dot net
2022-06-13 22:27 ` msebor at gcc dot gnu.org
2022-06-14  0:00 ` kees at outflux dot net
2022-06-14  5:09 ` siddhesh at gcc dot gnu.org
2022-06-14  5:21 ` siddhesh at gcc dot gnu.org
2022-06-14  7:25 ` jakub at gcc dot gnu.org
2022-06-14 15:00 ` qinzhao at gcc dot gnu.org
2022-06-14 15:39 ` siddhesh at gcc dot gnu.org
2022-06-14 16:02 ` qing.zhao at oracle dot com
2022-06-14 16:17 ` jakub at gcc dot gnu.org
2022-06-14 21:03 ` qinzhao at gcc dot gnu.org
2022-06-14 21:12 ` jakub at gcc dot gnu.org
2022-06-25  0:52 ` foom at fuhm dot net
2022-06-27 14:01 ` qinzhao at gcc dot gnu.org
2022-07-06 16:16 ` foom at fuhm dot net
2022-07-06 16:49 ` kees at outflux dot net
2022-07-06 17:53 ` qinzhao at gcc dot gnu.org
2022-07-06 19:30 ` foom at fuhm dot net
2022-07-06 19:46 ` foom at fuhm dot net
2022-07-06 20:01 ` qinzhao at gcc dot gnu.org
2022-07-06 20:05 ` qinzhao at gcc dot gnu.org
2022-07-22 22:33 ` isanbard at gmail dot com
2022-07-23  1:57 ` kees at outflux dot net
2022-10-07 17:44 ` cvs-commit at gcc dot gnu.org
2022-12-21 20:47 ` qinzhao at gcc dot gnu.org
2023-06-21 19:47 ` qinzhao at gcc dot gnu.org

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).