* bug in valarray header
@ 1999-08-01 18:13 Reza Habib
1999-08-31 23:49 ` Reza Habib
0 siblings, 1 reply; 2+ messages in thread
From: Reza Habib @ 1999-08-01 18:13 UTC (permalink / raw)
To: Cygwin Mailing List
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<float> Image(&(vector<float>(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<float>(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
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug in valarray header
1999-08-01 18:13 bug in valarray header Reza Habib
@ 1999-08-31 23:49 ` Reza Habib
0 siblings, 0 replies; 2+ messages in thread
From: Reza Habib @ 1999-08-31 23:49 UTC (permalink / raw)
To: Cygwin Mailing List
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<float> Image(&(vector<float>(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<float>(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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-08-31 23:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-01 18:13 bug in valarray header Reza Habib
1999-08-31 23:49 ` Reza Habib
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).