This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Valarray: bug in binary operator
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: Valarray: bug in binary operator
- From: Serge Barral <sbarral at ippt dot gov dot pl>
- Date: Thu, 18 Nov 1999 13:36:19 +0100
Hi,
A code like the following would result in a core dump:
valarray<double> A(1.0,80), B(80);
B=A*(A+1);
More generaly, a binary operator taking a valarray as first argument and
a template expression as second argument gives either unexpected results
or a segfault ( at least with the libstdc++ of gcc 2.95.1 and with
libstdc++2.90.6 - I didn't try the cvs version).
The patch below seems to adress this problem.
Congratulation for your implementation of valarray. I was looking for
something more lightweight than Blitz++, and your valarray really works
fine: compilation is 5 time faster, and doesn't eat all my RAM (I didn't
make a run-time comparison thought)
Serge
===========================================================
in valarray_meta.h
452c452
< _BinClos (const valarray<_Tp> __e1, const _Dom& __e2)
---
> _BinClos (const valarray<_Tp>& __e1, const _Dom& __e2)