From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 42CA4395CC5F; Thu, 30 Apr 2020 12:35:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42CA4395CC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588250124; bh=vBMQhxKo8RrQUUra+cCwfXyBPFmL+DeXjurCK9hBzVM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OSaJ+KcAkfKMofAeVb/jRWJVXsUWCHDUl+gi7jggRNNeaUdu8ZQShOHoD1g5hkAN6 SxiO+oB6TbXt+FK2bCYamUWq1AdcYSHrP+2E+hKfWCrQAjbeX1F3/2DgfNtcn5ZZ83 mtXW9M+s4kXjySSDRALR2x4aXMpIoSDyTq2fjNY8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94775] [8/9/10 Regression] ICE in strip_typedefs, at cp/tree.c:1734 since r8-4668-g8a5ee94a082b3d48 Date: Thu, 30 Apr 2020 12:35:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Thu, 30 Apr 2020 12:35:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94775 --- Comment #10 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:6318fe77395fc0dd59419bc4d69cd06ac0158e54 commit r10-8071-g6318fe77395fc0dd59419bc4d69cd06ac0158e54 Author: Marek Polacek Date: Wed Apr 29 15:36:35 2020 -0400 tree: Don't reuse types if TYPE_USER_ALIGN differ [PR94775] Here we trip on the TYPE_USER_ALIGN (t) assert in strip_typedefs: it gets "const d[0]" with TYPE_USER_ALIGN=3D0 but the result built by build_cplus_array_type is "const char[0]" with TYPE_USER_ALIGN=3D1. When we strip_typedefs the element of the array "const d", we see it's a typedef_variant_p, so we look at its DECL_ORIGINAL_TYPE, which is char, but we need to add the const qualifier, so we call cp_build_qualified_type -> build_qualified_type where get_qualified_type checks to see if we already have such a type by walking the variants list, which in this case is: char -> c -> const char -> const char -> d -> const d Because check_base_type only checks TYPE_ALIGN and not TYPE_USER_ALIGN, we choose the first const char, which has TYPE_USER_ALIGN set. If the element type of an array has TYPE_USER_ALIGN, the array type gets it to= o. So we can make check_base_type stricter. I was afraid that it might ma= ke us reuse types less often, but measuring showed that we build the same amount of types with and without the patch, while bootstrapping. PR c++/94775 * tree.c (check_base_type): Return true only if TYPE_USER_ALIGN match. (check_aligned_type): Check if TYPE_USER_ALIGN match. * g++.dg/warn/Warray-bounds-10.C: New test.=