From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8479F3858D20; Tue, 20 Feb 2024 21:35:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8479F3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708464915; bh=BjfUWDcXHm8qk/zl0YxChd9l4UsfrPIRTKMWufI4tyI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=irL5YrgzcXF3e3dQdQVz8hyuSICqbhOI4/RFik9xvJ9UStvNGHoVhf3xK1g9ZGIaH W/AwLOn0Rnj7bhLkc0+ZeJjTej/DEOODsARbV3hkO0MUmBclpQr252J92J/CXXfvM+ Ce5ED5h1HoN2aUQPeMKDwlzQIahiByZlFnr0iB8U= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/89224] [11/12/13/14 Regression] subscript of const vector has the wrong type Date: Tue, 20 Feb 2024 21:35:15 +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: 8.2.0 X-Bugzilla-Keywords: accepts-invalid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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=3D89224 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot = gnu.org --- Comment #13 from Andrew Pinski --- Ok, I have a simple fix: ``` diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index e15eff698df..9d0e1ae574d 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -8949,9 +8949,10 @@ convert_vector_to_array_for_subscript (location_t lo= c, to not run into the gimplifiers premature setting of DECL_GIMPLE_REG_P for function parameters. */ c_common_mark_addressable_vec (*vecp); + tree newinnertype =3D build_qualified_type (TREE_TYPE (type), TYPE_Q= UALS (type)); *vecp =3D build1 (VIEW_CONVERT_EXPR, - build_array_type_nelts (TREE_TYPE (type), + build_array_type_nelts (newinnertype, TYPE_VECTOR_SUBPARTS (type)), *vecp); } ```=