X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 24 Oct 2007 11:57:43 -0700 (PDT) From: Brad Bell To: cygwin AT cygwin DOT com Subject: BUG REPORT: Cygwin, g++, -O2, static member function, std::string Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-796916914-1642293218-1193252263=:16189" X-Antivirus: Scanned by F-Prot Antivirus (http://www.f-prot.com) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com ---796916914-1642293218-1193252263=:16189 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 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 # 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 ---796916914-1642293218-1193252263=:16189 Content-Type: TEXT/x-c++hdr; charset="US-ASCII"; name="bug0.hpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug0.hpp" Content-Description: Content-ID: IyBpbmNsdWRlIDxzdHJpbmc+DQpjbGFzcyBFbGVtZW50IHsNCnB1YmxpYzoN CglzdGQ6OnN0cmluZyAgIGZpbGU7DQoNCglzdGF0aWMgRWxlbWVudCAqcm9v dCh2b2lkKQ0KCXsJc3RhdGljIEVsZW1lbnQgcjsNCgkJcmV0dXJuICZyOw0K CX0NCg0KfTsgDQo= ---796916914-1642293218-1193252263=:16189 Content-Type: TEXT/x-c++src; charset="US-ASCII"; name="bug1.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug1.cpp" Content-Description: Content-ID: IyBpbmNsdWRlICJidWcwLmhwcCINCmV4dGVybiB2b2lkIGJ1ZzIodm9pZCk7 DQppbnQgbWFpbih2b2lkKQ0KewlzdGQ6OnN0cmluZyBzdHIoIkEiKTsNCglj aGFyIGMgPSBzdHJbMF07DQoNCglFbGVtZW50ICpyID0gRWxlbWVudDo6cm9v dCgpOw0KCWJ1ZzIoKTsNCg0KCXJldHVybiAwOw0KfQ0K ---796916914-1642293218-1193252263=:16189 Content-Type: TEXT/x-c++src; charset="US-ASCII"; name="bug2.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug2.cpp" Content-Description: Content-ID: IyBpbmNsdWRlIDxjYXNzZXJ0Pg0KIyBpbmNsdWRlICJidWcwLmhwcCINCnZv aWQgYnVnMih2b2lkKQ0Kew0KCUVsZW1lbnQgKnIgPSBFbGVtZW50Ojpyb290 KCk7DQoJRWxlbWVudCAqcyA9IEVsZW1lbnQ6OnJvb3QoKTsNCg0KCWFzc2Vy dCggciAhPSAwICk7DQp9DQo= ---796916914-1642293218-1193252263=:16189 Content-Type: text/plain; charset=us-ascii -- 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/ ---796916914-1642293218-1193252263=:16189--