From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5D14D3857C4E; Mon, 4 Oct 2021 11:43:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D14D3857C4E From: "jakub at gcc dot 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: Mon, 04 Oct 2021 11:43:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2021 11:43:22 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102586 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- So, seems the C9 type is 32-byte, with 8-byte virtual table pointers at off= set 0 and 16 bytes (and the rest is padding), C5 is 24-byte with virtual table pointers at offsets 0 and 8 bytes (and the rest is padding), C4 is 16-byte = with virtual table pointers at offset 0 (and the rest is padding). But what the middle-end sees is that there is a FIELD_DECL with C5 type at offset 0 with size 9 bytes and then a FIELD_DECL with C4 type at offset 16 = with size 9 bytes. The __builtin_clear_padding handling code when called on a FIELD_DECL with smaller DECL_SIZE_UNIT than TYPE_SIZE_UNIT is able to ignore fields that are wholy beyond the size and also the default behavior is that everything is padding until proven otherwise, so for padding bytes nothing changes. The reason for the ICE is that the first FIELD_DECL with C5 type says 9 byt= es and the type has 8 byte, 8 byte and 1 byte fields (2 virtual table pointers= and one padding byte). So, in that case it is unclear what the code should do. Shall it treat the fields that partially fall into the range and partially don't as padding (ignore them), or is there no way to do this using the TREE_TYPE of FIELD_DECLs that the middle-end sees and one needs to use some other types (I vaguely remember the C++ FE has some variant RECORD_TYPEs for the virtual bases that actually reflect what is present and where, but I ha= ve no idea if that is visible to the middle-end somewhere)?=