BUG REPORT: Cygwin, g++, -O2, static member function, std::string
Brad Bell
bradbell@apl.washington.edu
Wed Oct 24 18:57:00 GMT 2007
This is a reply to the message
http://cygwin.com/ml/cygwin/2007-10/msg00508.html
where the following request was made
Can you post the bug{1,2}.cpp files ?
Note that the original bug report is at
http://cygwin.com/ml/cygwin/2007-10/msg00507.html
I am attaching the requested files as well as a neceesary include file.
All these files are created by bug.sh when it is run.
I did not realize that it is hard to open *.sh files as text (when they
are attached to a message). Sorry about that. I am including the bug.sh
script below:
---------------------- cut here ------------------------------------------
#! /bin/bash # echo "BUG REPORT: Cygwin, g++, -O2, static member
function, std::string" echo "RUN COMMAND: $0 $*" echo "RESULT:
assertion \"r != 0\" failed" echo "SIDE EFFECTS: the files ./bug0.hpp,
bug1.cpp, and bug2.cpp are created." # cat << EOF > bug0.hpp # include
<string> class Element { public:
std::string file;
static Element *root(void)
{ static Element r;
return &r;
}
};
EOF
cat << EOF > bug1.cpp
# include "bug0.hpp"
extern void bug2(void);
int main(void)
{ std::string str("A");
char c = str[0];
Element *r = Element::root();
bug2();
return 0;
}
EOF
cat << EOF > bug2.cpp
# include <cassert>
# include "bug0.hpp"
void bug2(void)
{
Element *r = Element::root();
Element *s = Element::root();
assert( r != 0 );
}
EOF
echo
echo "uname -a"
uname -a
echo
echo "g++ --version"
g++ --version
echo "g++ bug1.cpp bug2.cpp -O1 -o bug"
g++ bug1.cpp bug2.cpp -O1 -o bug
echo "./bug"
./bug
echo "g++ bug1.cpp bug2.cpp -O2 -o bug"
g++ bug1.cpp bug2.cpp -O2 -o bug
echo "./bug"
./bug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug0.hpp
Type: text/x-c++hdr
Size: 146 bytes
Desc:
URL: <http://cygwin.com/pipermail/cygwin/attachments/20071024/ad2c6167/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug1.cpp
Type: text/x-c++src
Size: 168 bytes
Desc:
URL: <http://cygwin.com/pipermail/cygwin/attachments/20071024/ad2c6167/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug2.cpp
Type: text/x-c++src
Size: 152 bytes
Desc:
URL: <http://cygwin.com/pipermail/cygwin/attachments/20071024/ad2c6167/attachment-0002.bin>
-------------- next part --------------
--
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/
More information about the Cygwin
mailing list