From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Reza Habib" To: "Cygwin Mailing List" Subject: bug in valarray header Date: Tue, 31 Aug 1999 23:49:00 -0000 Message-ID: <000001bedc84$93b10bc0$cf9194d1@newton> X-SW-Source: 1999-08n/msg00010.html Message-ID: <19990831234900.YfD8iBB0ER-UWLQ_11FfN9KBwWVxgJS9Siz5pb-ZajE@z> Hello. I'm porting a program I've written in borland c++ builder 4.0 to gcc 2.95. The program uses the valarray classes of the standard c++ library. The program compiles and runs correctly with borland c++ builder however the exact same code causes a segmentation fault with gcc. The culprit line of source code as revealed by gdb is: Mask = Mask && (Image > 0.0f); Here is the context within which that line occurs: //Convert image to float by assigning to valarray valarray Image(&(vector(ByteImage,ByteImage + IMAGEFILESIZE + 1).front()),IMAGEFILESIZE); //Replace values less than 1/4 of maximum value with 0 Image[Image <= (Image.max() / 4.0f)] = 0.0f; //Ratio normalize image: divide each value by the mean of the image Image /= (Image.sum() / (valarray(Image[Image > 0.0f])).size()); //Update mask with non-zero columns of current image Mask = Mask && (Image > 0.0f); This is the output for gdb: 74 Mask = Mask && (Image > 0.0f); (gdb) n n Program received signal SIGSEGV, Segmentation fault. 0x41a279 in LM786 () at //D/Mingw32/bin/../lib/gcc-lib/i386-mingw32/2.95/../../../../include/g++- 3/std/std_valarray.h:266 266 //D/Mingw32/bin/../lib/gcc-lib/i386-mingw32/2.95/../../../../include/g++ -3/std/std_valarray.h: No such file or directory. I got no warnings or errors when compiling the code and as I mentioned the code compiled and ran perfectly when compiled with borland c++ builder 4. So my guess is that this is a problem with the gcc version of the valarray header. Any clues into this matter would be greatly appreciated. Thanks. Reza -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com