This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Valarray: bug in binary operator


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]