public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/89224] [11/12/13/14/15 Regression] subscript of const vector has the wrong type
Date: Tue, 07 May 2024 23:50:22 +0000	[thread overview]
Message-ID: <bug-89224-4-R9jekMUAMN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-89224-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #19 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Andrew Pinski
<pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:cacc48014c7fdb888b4449830b567e5375dfb4e3

commit r14-10183-gcacc48014c7fdb888b4449830b567e5375dfb4e3
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Tue Feb 20 13:38:28 2024 -0800

    c++/c-common: Fix convert_vector_to_array_for_subscript for qualified
vector types [PR89224]

    After r7-987-gf17a223de829cb, the access for the elements of a vector type
would lose the qualifiers.
    So if we had `constvector[0]`, the type of the element of the array would
not have const on it.
    This was due to a missing build_qualified_type for the inner type of the
vector when building the array type.
    We need to add back the call to build_qualified_type and now the access has
the correct qualifiers. So the
    overloads and even if it is a lvalue or rvalue is correctly done.

    Note we correctly now reject the testcase gcc.dg/pr83415.c which was
incorrectly accepted after r7-987-gf17a223de829cb.

    Built and tested for aarch64-linux-gnu.

            PR c++/89224

    gcc/c-family/ChangeLog:

            * c-common.cc (convert_vector_to_array_for_subscript): Call
build_qualified_type
            for the inner type.

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_array_reference): Compare main variants
            for the vector/array types instead of the types directly.

    gcc/testsuite/ChangeLog:

            * g++.dg/torture/vector-subaccess-1.C: New test.
            * gcc.dg/pr83415.c: Change warning to error.

    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
    (cherry picked from commit 4421d35167b3083e0f2e4c84c91fded09a30cf22)

  parent reply	other threads:[~2024-05-07 23:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-89224-4@http.gcc.gnu.org/bugzilla/>
2021-08-16 20:48 ` [Bug c++/89224] subscript of const vector is considered a rvalue pinskia at gcc dot gnu.org
2021-08-16 20:49 ` [Bug c++/89224] [9/10/11/12 Regregression] " pinskia at gcc dot gnu.org
2021-08-16 20:50 ` pinskia at gcc dot gnu.org
2021-08-16 20:52 ` [Bug c++/89224] [9/10/11/12 Regregression] subscript of const vector has the wrong type pinskia at gcc dot gnu.org
2021-08-16 20:54 ` pinskia at gcc dot gnu.org
2021-08-16 20:56 ` pinskia at gcc dot gnu.org
2021-08-16 20:57 ` pinskia at gcc dot gnu.org
2022-05-27  9:49 ` [Bug c++/89224] [10/11/12 Regression] " rguenth at gcc dot gnu.org
2022-06-28 10:36 ` jakub at gcc dot gnu.org
2022-07-26 13:49 ` rguenth at gcc dot gnu.org
2022-10-19  9:08 ` [Bug c++/89224] [10/11/12/13 " rguenth at gcc dot gnu.org
2023-07-07 10:34 ` [Bug c++/89224] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-02-20 21:29 ` pinskia at gcc dot gnu.org
2024-02-20 21:35 ` pinskia at gcc dot gnu.org
2024-02-20 22:20 ` pinskia at gcc dot gnu.org
2024-02-20 22:29 ` pinskia at gcc dot gnu.org
2024-02-21  3:07 ` pinskia at gcc dot gnu.org
2024-05-07 22:42 ` [Bug c++/89224] [11/12/13/14/15 " cvs-commit at gcc dot gnu.org
2024-05-07 22:45 ` pinskia at gcc dot gnu.org
2024-05-07 23:50 ` cvs-commit at gcc dot gnu.org [this message]
2024-05-08  1:19 ` cvs-commit at gcc dot gnu.org
2024-05-08  2:23 ` cvs-commit at gcc dot gnu.org
2024-05-08  3:19 ` cvs-commit at gcc dot gnu.org
2024-05-08  3:20 ` pinskia at gcc dot gnu.org
2024-05-09  9:21 ` cvs-commit at gcc dot gnu.org
2024-05-09  9:22 ` cvs-commit at gcc dot gnu.org
2024-05-09  9:23 ` cvs-commit at gcc dot gnu.org
2024-05-09  9:24 ` cvs-commit at gcc dot gnu.org
2024-05-09  9:24 ` cvs-commit 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-89224-4-R9jekMUAMN@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).