From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4279538708D5; Tue, 25 Jun 2024 21:45:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4279538708D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719351927; bh=HAgnxbiNrKeLr0tqygGLK7PAdNQzcYmfN90bvX4lwSU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V7b4Pe4NgekRfHrpbflTFqnZsC1B04fk2+To6iFZAl0iHWz7HgNvTnq0/qie0ENxy wt1QTd/vJ2Wa1NCeNbscv3m1QIzeyoFXbWpJBKoXtbWvfkaKwhFIguepwHFdoGucz9 KB3IGi40j39jsQnjibkAR6wdbKVlaO71TuR97vt8= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115476] [13/14/15 Regression] __has_unique_object_representation ICE with array of uninstantiated type of unknown bound Date: Tue, 25 Jun 2024 21:45:24 +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: 15.0 X-Bugzilla-Keywords: ice-on-invalid-code, 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: 13.4 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115476 --- Comment #9 from GCC Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:fc382a373e6824bb998007d1dcb0805b0cf4b8e8 commit r15-1625-gfc382a373e6824bb998007d1dcb0805b0cf4b8e8 Author: Marek Polacek Date: Mon Jun 17 17:53:12 2024 -0400 c++: ICE with __has_unique_object_representations [PR115476] Here we started to ICE with r13-25: in check_trait_type, for "X[]" we return true here: if (kind =3D=3D 1 && TREE_CODE (type) =3D=3D ARRAY_TYPE && !TYPE_DOMA= IN (type)) return true; // Array of unknown bound. Don't care about completene= ss. and then end up crashing in record_has_unique_obj_representations: 4836 if (cur !=3D wi::to_offset (sz)) because sz is null. =20=20=20 https://eel.is/c++draft/type.traits#tab:meta.unary.prop-row-47-column-3-sen= tence-1 says that the preconditions for __has_unique_object_representations are: "T shall be a complete type, cv void, or an array of unknown bound" and that "For an array type T, the same result as has_unique_object_representations_v>" so T[] should be treated as T. So we should use kind=3D=3D2 for the trait. PR c++/115476 gcc/cp/ChangeLog: * semantics.cc (finish_trait_expr) : Move below to call check_trait_type with kind=3D=3D2. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/has-unique-obj-representations4.C: New test.=