slice valarrays with std::string -> segfault
Gabriel Dos Reis
gdr@integrable-solutions.net
Sat Dec 10 22:18:00 GMT 2005
Paolo Carlini <pcarlini@suse.de> writes:
| Paolo Carlini wrote:
|
| >Gaby, I see __valarray_copy used (instead of __valarray_copy_construct)
| >by the conversion constructor from slice_array for any type T: i.e., no
| >placement new, that cannot possibly work a T such as 'struct element' in
| >the posted snippet. Indeed, lots and lots of errors from valgrind...
| >
| >
| Just to explain concretely what I mean, the attached quick and dirty
| hack avoids the Seg fault and makes valgrind happy. I think it tells us
| something...
I just saw this message. As said in previous mails, your analysis is
correct that the use of _copy instead of _copy_construct was
thoughtless -- other constructors carefully use _copy_construct.
[...]
| + __valarray_construct(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)
Can we do without this additional layer?
Otherwise, the patch is correct with that change.
Thanks!
-- Gaby
More information about the Libstdc++
mailing list