valarray_copy implementation question

Christian BRUEL christian.bruel@st.com
Tue Nov 17 08:26:00 GMT 2009


OK, as expected the attached reduced case reports a read error with 
valgrind :

==10504== Invalid read of size 1
==10504==    at 0x400D3E: void 
std::__valarray_copy<int>(std::_Array<int>, unsigned long, 
std::_Array<int>, std::_Array<bool>) (in /home/bruel/tmp/a.out)
==10504==    by 0x400ADB: 
std::mask_array<int>::operator=(std::valarray<int> const&) const (in 
/home/bruel/tmp/a.out)
==10504==    by 0x4007E0: main (in /home/bruel/tmp/a.out)
==10504==  Address 0x4e2a091 is 0 bytes after a block of size 1 alloc'd

compiled with g++ -O2 x86_64-unknown-linux-gnu 3.3.3

and goes into an infinite loop on SH4 with a gcc 4.4

Cheers

Christian

Paolo Carlini wrote:
> Gabriel Dos Reis wrote:
>> I did not consider the interpretation put forward by Christian, although I can
>> see his point.  I suspect I have to  double-check what Fortran
>> does in this case and consider whether it actually is a LWG issue.
>>   
> Thanks Gaby for your help.
>> Do you know what other implementations do?
>>   
> I can check another one. If you can pass me a precise testcase, then I
> can give you the data point.
> 
> Paolo.
> 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: va.cxx
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20091117/9e10e098/attachment.cxx>


More information about the Libstdc++ mailing list