Valarray: bug in binary operator

Gabriel Dos Reis dosreis@cmla.ens-cachan.fr
Thu Nov 18 16:44:00 GMT 1999


Serge Barral <sbarral@ippt.gov.pl> writes:

| 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.

Thank you very much.  As explained in 

	http://egcs.cygnus.com/ml/gcc-bugs/1999-10/msg00512.html

the bug was fixed a while ago.  But for some administrative reasons,
the fix didn't find its way in the dot releases :-(

I hope the next release of GCC/valarray will be in sync with 2.96. 

| 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)

Thanks for you feedback.  If you happen to do some runtime comparison,
please send me the results.

-- Gaby


More information about the Libstdc++ mailing list