delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
Sender: | cygwin-owner AT sourceware DOT cygnus DOT com |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com> |
List-Archive: | <http://sourceware.cygnus.com/ml/cygwin/> |
List-Help: | <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, |
<http://sourceware.cygnus.com/ml/#faqs> | |
Delivered-To: | mailing list cygwin AT sourceware DOT cygnus DOT com |
From: | "Reza Habib" <reza AT psych DOT utoronto DOT ca> |
To: | "Cygwin Mailing List" <cygwin AT sourceware DOT cygnus DOT com> |
Subject: | bug in valarray header |
Date: | Sun, 1 Aug 1999 21:15:58 -0400 |
Message-ID: | <000001bedc84$93b10bc0$cf9194d1@newton> |
MIME-Version: | 1.0 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook 8.5, Build 4.71.2377.0 |
Importance: | Normal |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
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 AT sourceware DOT cygnus DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |