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
# include <string>
class Element {
public:
std::string file;
static Element *root(void)
{ static Element r;
return &r;
}
};
# 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;
}
# include <cassert>
# include "bug0.hpp"
void bug2(void)
{
Element *r = Element::root();
Element *s = Element::root();
assert( r != 0 );
}
--
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/