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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-01-20
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot 
gnu.org
            Summary|[9/10 Regression] ICE when  |[9 Regression] ICE when
                   |initialising vector         |initialising vector
                   |references with             |references with
                   |-flax-vector-conversions    |-flax-vector-conversions
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Bisection shows this started already to ICE with r260621 i.e.
r9-595-g955da5e5443724cb59f8fbd854c13e78c68bf000 and got fixed by your:

Author: rsandifo
Date: Mon Dec 23 09:43:35 2019
New Revision: 279716

URL: https://gcc.gnu.org/viewcvs?rev=279716&root=gcc&view=rev
Log:
[C++] Fix ICE for binding lax vector conversions to references (PR 93014)

This test:

typedef unsigned int v4si __attribute__ ((vector_size(16)));
typedef unsigned char v16qi __attribute__ ((vector_size(16)));
extern v16qi x;
v4si &y = x;

ICEs with:

a.c:4:11: internal compiler error: in convert_like_real, at cp/call.c:7670

This started with r260780, which had the effect of making lvalue_kind
look through VIEW_CONVERT_EXPR in all cases, not just for location
wrappers.  This also means that:

typedef unsigned int v4si __attribute__ ((vector_size(16)));
typedef unsigned char v16qi __attribute__ ((vector_size(16)));
extern v16qi x;
v4si &y = reinterpret_cast<v4si>(x);

is now valid despite the result of the cast being an rvalue.

The patch attempts to fix that by calling rvalue on the input to the
conversion, so that the tree looks the same as for:

  extern v16qi x;
  v4si &y = (v4si)x;

which is already handled correctly.

2019-12-23  Richard Sandiford  <richard.sandif...@arm.com>

gcc/cp/
        * cvt.c (ocp_convert): Apply rvalue to the source of vector
        conversions.
        * typeck.c (build_reinterpret_cast_1): Likewise.

gcc/testsuite/
        * g++.dg/ext/vector39.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/vector39.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cvt.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog

Reply via email to