C++ PATCHes to xvalue handling

Sudakshina Das sudi.das@arm.com
Tue May 29 09:34:00 GMT 2018


Hi Jason

On 25/05/18 21:55, Jason Merrill wrote:
> On Fri, May 25, 2018 at 4:08 PM, Jason Merrill <jason@redhat.com> wrote:
>> On Fri, May 25, 2018 at 12:40 PM, Sudakshina Das <sudi.das@arm.com> wrote:
>>> On 23/05/18 18:21, Jason Merrill wrote:
>>>>
>>>> The first patch implements the adjustments from core issues 616 and
>>>> 1213 to the value category of subobjects of class prvalues: they were
>>>> considered prvalues themselves, but that was kind of nonsensical.  Now
>>>> they are considered xvalues.  Along with this, I've removed the
>>>> diagnostic distinction between xvalues and prvalues when trying to use
>>>> one or the other as an lvalue; the important thing is that they are
>>>> rvalues.
>>>>
>>>> The second patch corrects various issues with casts and xvalues/rvalue
>>>> references: we were treating an xvalue operand to dynamic_cast as an
>>>> lvalue, and we were objecting to casts from prvalue to rvalue
>>>> reference type.
>>>>
>>>
>>> With the second patch:
>>> commit f7d2790049fd1e59af4b69ee12f7c101cfe4cdab
>>> Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
>>> Date:   Wed May 23 17:21:39 2018 +0000
>>>
>>>          Fix cast to rvalue reference from prvalue.
>>>
>>>          * cvt.c (diagnose_ref_binding): Handle rvalue reference.
>>>          * rtti.c (build_dynamic_cast_1): Don't try to build a reference to
>>>          non-class type.  Handle xvalue argument.
>>>          * typeck.c (build_reinterpret_cast_1): Allow cast from prvalue to
>>>          rvalue reference.
>>>          * semantics.c (finish_compound_literal): Do direct-initialization,
>>>          not cast, to initialize a reference.
>>>
>>>      git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260622
>>> 138bc75d-0d04-0410-961f-82ee72b054a4
>>>
>>> I have observed the following failure in Spec2017 while building
>>> 510.parest_r on aarch64-none-linux-gnu
>>>
>>> aarch64-none-linux-gnu-g++ -c -o source/numerics/matrices.all_dimensions.o
>>> -DSPEC -DNDEBUG -Iinclude -I. -DSPEC_AUTO_SUPPRESS_OPENMP
>>> -mcpu=cortex-a57+crypto -Ofast -fomit-frame-pointer     -fpermissive
>>> -DSPEC_LP64 source/numerics/matrices.all_dimensions.cc
>>>
>>> source/numerics/matrices.all_dimensions.cc: In static member function
>>> 'static void dealii::MatrixTools::apply_boundary_values(const
>>> std::map<unsigned int, double>&, dealii::BlockSparseMatrix<number>&,
>>> dealii::BlockVector<number>&, dealii::BlockVector<number>&, bool)':
>>>
>>> source/numerics/matrices.all_dimensions.cc:469:50: error: lvalue required as
>>> unary '&' operand
>>>
>>>          [this_sparsity.get_rowstart_indices()[row]];
>>>
>>>                                                    ^
>>>
>>> source/numerics/matrices.all_dimensions.cc:472:55: error: lvalue required as
>>> unary '&' operand
>>>
>>>             [this_sparsity.get_rowstart_indices()[row]+1],
>>>
>>>                                                         ^
>>>
>>> source/numerics/matrices.all_dimensions.cc:474:55: error: lvalue required as
>>> unary '&' operand
>>>
>>>             [this_sparsity.get_rowstart_indices()[row+1]],
>>>
>>>                                                         ^
>>>
>>> source/numerics/matrices.all_dimensions.cc:479:49: error: lvalue required as
>>> unary '&' operand
>>>
>>>         [this_sparsity.get_rowstart_indices()[row]],
>>>
>>>                                                   ^
>>>
>>> source/numerics/matrices.all_dimensions.cc:481:51: error: lvalue required as
>>> unary '&' operand
>>>
>>>         [this_sparsity.get_rowstart_indices()[row+1]],
>>>
>>>                                                     ^
>>>
>>> source/numerics/matrices.all_dimensions.cc:510:50: error: lvalue required as
>>> unary '&' operand
>>>
>>>            [this_sparsity.get_rowstart_indices()[0]]);
>>>
>>> Sudi
>>
>> Thanks, investigating.
> 
> Fixed thus.

Thanks for fixing this!

Sudi
> 



More information about the Gcc-patches mailing list