public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/102586] [12 Regression] ICE in clear_padding_type, at gimple-fold.c:4798 since r12-3433-ga25e0b5e6ac8a77a
Date: Thu, 10 Feb 2022 15:29:53 +0000	[thread overview]
Message-ID: <bug-102586-4-wUcrY3QmEX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102586-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, on
struct C0 {};
struct C1 {};
struct C2 : C1, virtual C0 {};
struct C3 : virtual C2, C1 { virtual int foo () { return 1; } };
struct C6 { char c; };
struct C7 : virtual C6, virtual C3, C1 { virtual int foo () { return 4; } };
struct C8 : C7 { virtual int foo () { return 5; } };

__attribute__((noipa)) void
foo (C8 *q)
{
  __builtin_clear_padding (q);
}

C8 c8;
C7 c7;

void
bar ()
{
  c8.c = 42;
  c7.c = 43;
}

distilled from the testcase in the patch, c8.c is at 9 bytes into c8, while
c7.c is at 8 bytes into c7, so that is likely the reason why the code considers
both byte at offset 8 and 9 as non-padding - the first FIELD_DECL in C8 is
one with C7 type (32 byte long like C8) but the field size is 9 bytes, so that
the __builtin_clear_padding code thinks the first 9 bytes are non-padding,
virtual table pointer inside of C2, then empty type C1 at off 8, then C6 at off
8 with the c 1-byte field, then C3 at offset 16 with 9 byte size but all this
is already outside of the size of FIELD_DECL with C7 type.
But C8 has a FIELD_DECL with C6 type at off 9...

  parent reply	other threads:[~2022-02-10 15:29 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04  7:30 [Bug tree-optimization/102586] New: " marxin at gcc dot gnu.org
2021-10-04  7:30 ` [Bug tree-optimization/102586] " marxin at gcc dot gnu.org
2021-10-04  8:21 ` jakub at gcc dot gnu.org
2021-10-04  8:22 ` marxin at gcc dot gnu.org
2021-10-04 11:43 ` jakub at gcc dot gnu.org
2021-10-04 12:04 ` jakub at gcc dot gnu.org
2021-11-15 13:03 ` jakub at gcc dot gnu.org
2021-11-15 13:05 ` jakub at gcc dot gnu.org
2022-01-17 13:14 ` rguenth at gcc dot gnu.org
2022-02-09 17:21 ` jason at gcc dot gnu.org
2022-02-10 14:08 ` jakub at gcc dot gnu.org
2022-02-10 14:18 ` jakub at gcc dot gnu.org
2022-02-10 15:29 ` jakub at gcc dot gnu.org [this message]
2022-02-10 15:35 ` jakub at gcc dot gnu.org
2022-02-10 15:56 ` jason at gcc dot gnu.org
2022-02-10 18:30 ` jakub at gcc dot gnu.org
2022-02-10 18:45 ` jason at gcc dot gnu.org
2022-02-10 19:27 ` jakub at gcc dot gnu.org
2022-02-10 22:07 ` jason at gcc dot gnu.org
2022-02-10 22:27 ` jakub at gcc dot gnu.org
2022-02-10 22:29 ` jakub at gcc dot gnu.org
2022-02-10 22:34 ` jakub at gcc dot gnu.org
2022-02-11  1:47 ` rodgertq at gcc dot gnu.org
2022-02-11 12:31 ` jakub at gcc dot gnu.org
2022-02-11 15:29 ` jason at gcc dot gnu.org
2022-02-11 16:23 ` qing.zhao at oracle dot com
2022-02-11 16:39 ` jakub at gcc dot gnu.org
2022-02-11 17:36 ` qinzhao at gcc dot gnu.org
2022-02-11 17:47 ` jakub at gcc dot gnu.org
2022-02-11 21:52 ` qing.zhao at oracle dot com
2022-03-12  4:40 ` jason at gcc dot gnu.org
2022-03-14  9:49 ` cvs-commit at gcc dot gnu.org
2022-04-07  7:15 ` cvs-commit at gcc dot gnu.org
2022-04-07  7:19 ` jakub at gcc dot gnu.org

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-102586-4-wUcrY3QmEX@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).