I seem to have run across a bug using g++ with -O2 under Cygwin. It has to do with using static class member functions and standard string.
The bash shell script command ./bug.shcreates three files, compiles, links, and runs the result. I have run this command on several Cygwin systems and gotten results similar to those in bug_cygwin.out; i.e., the assert
assertion r != 0 failedI have run the same command on several Linux systems and gotten results similar to those in bug_linux.out; i.e., no assertion.
bug.sh
Description: bash shell script
BUG REPORT: Cygwin, g++, -O2, static member function, std::string RUN COMMAND: ./bug.sh RESULT: assertion "r != 0" failed SIDE EFFECTS: the files ./bug0.hpp, bug1.cpp, and bug2.cpp are created. uname -a CYGWIN_NT-5.1 pc-bbell 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 Cygwin g++ --version g++ (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. g++ bug1.cpp bug2.cpp -O1 -o bug ./bug g++ bug1.cpp bug2.cpp -O2 -o bug ./bug assertion "r != 0" failed: file "bug2.cpp", line 8 11 [sig] bug 1924 C:\cygwin\home\Brad\trash\bug.exe: *** fatal error - call ed with threadlist_ix -1 ./bug.sh: line 58: 1924 Hangup ./bug
BUG REPORT: Cygwin, g++, -O2, static member function, std::string RUN COMMAND: ./bug.sh RESULT: assertion "r != 0" failed SIDE EFFECTS: the files ./bug0.hpp, bug1.cpp, and bug2.cpp are created. uname -a Linux snark 2.6.15-28-amd64-server #1 SMP Wed Jul 18 23:04:02 UTC 2007 x86_64 GNU/Linux g++ --version g++ (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. g++ bug1.cpp bug2.cpp -O1 -o bug ./bug g++ bug1.cpp bug2.cpp -O2 -o bug ./bug
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/