Blitz logo

Blitz Bugs :

From: Christopher Eltschka (christopher.eltschka_at_[hidden])
Date: 2003-08-07 14:15:57


Hello all,

the following program causes a segmentation fault with
blitz-0.6, if compiled with optimization under g++ 3.2.3:

#include <blitz/array.h>

int main()
{
  blitz::Array<double, 1> a(40, blitz::fortranArray);
  a(blitz::Range(1,2))= 1.0;
  std::cout << a << std::endl;
}

The error occurs only when optimizing (even if just -O1),
and only for Fortran-style arrays, and only if the range
starts with 1.

I'm compiling on Linux x86.

g++ -v:
Reading specs from
/psi/gcc-3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs
Configured with: ./configure --prefix=/psi/gcc-3.2
Thread model: posix
gcc version 3.2.3

gdb stack backtrace:

#0 0x08048abd in
evaluateWithStackTraversal1<blitz::_bz_ArrayExpr<blitz::_bz_ArrayExprConstant<double>
>, blitz::_bz_update<double, double> > (
    this=0xbffff764, expr=
       
{<ETBase<blitz::_bz_ArrayExpr<blitz::_bz_ArrayExprConstant<double> > >>
= {<No data fields>}, iter_ = {value_ = 1}})
    at /home/elc04564/inst/include/blitz/update.h:75
#1 0x08048898 in
evaluate<blitz::_bz_ArrayExpr<blitz::_bz_ArrayExprConstant<double> >,
blitz::_bz_update<double, double> > (this=0xbffff764, expr=Cannot access
memory at address 0x1
)
    at /home/elc04564/inst/include/blitz/array/expr.h:650
#2 0x0804850a in main () at
/home/elc04564/inst/include/blitz/array/expr.h:650

Is this a known bug (I've looked in the list archives, but didn't
find anything which for me seemed to be related)? More important:
Is there already a fix for this?

Thanks in advance,
Christopher Eltschka