Menu

#210 g++ optimization with threads broken

open
nobody
None
5
2005-05-31
2005-05-31
No

Hi,

Using gcc-c++-3.3.2-5 on aix 5.2, maint.-level 5, the following small test program segfaults in the ifstream constructor when compiled with anything more than -O0 _and_ -D_THREAD_SAFE:

#include <fstream>
int main(int argc, char **argv) {
std::ifstream *s = new std::ifstream();
return 0;
}

dbx says:
Segmentation fault in fetch_and_add at 0xd023dcd0
0xd023dcd0 (fetch_and_add+0x24) 7ca0412d stwcx. r5,r0,r8
(dbx) where
fetch_and_add() at 0xd023dcd0
locale._ZNSt6localeaSERKS_(??, ??) at 0xd248a2a4
_ZNSt8ios_base7_M_initEv(??) at 0xd248aa78
io-inst._ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E(??, ??) at 0x10002e0c
unnamed block $b14, line 106 in "istream"
unnamed block $b13, line 106 in "istream"
unnamed block $b6, line 106 in "istream"
unnamed block $b5, line 106 in "istream"
main(argc = ??, argv = ??), line 106 in "istream"

For me it's not clear if this is a bug in libstdc++ or g++, but since you guys don't have separate modules in your bug database ....

Thanks
-Fritz

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.