From mboxrd@z Thu Jan 1 00:00:00 1970 From: ljrittle@acm.org To: gcc-gnats@gcc.gnu.org Subject: c++/3082: C++ EH is broken for multithreaded programs Date: Fri, 08 Jun 2001 00:46:00 -0000 Message-id: <20010608074007.25855.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00284.html List-Id: >Number: 3082 >Category: c++ >Synopsis: C++ EH is broken for multithreaded programs >Confidential: no >Severity: serious >Priority: high >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Jun 08 00:46:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: ljrittle@acm.org >Release: unknown-1.0 >Organization: >Environment: *-*-linux, *-*-freebsd, others >Description: Memory used to hold state for EH processing is shared across threads due to a configuration error introduced when C++ EH code was moved from gcc/libgcc2.c to libstdc++-v3/libsupc++. This bug has been reported a few times on gcc-bugs. The attached test case was taken from (cleaned up only slightly): http://gcc.gnu.org/ml/gcc-bugs/2001-05/msg00855.html dave@hiauly1.hia.nrc.ca also reported this problem with an initial patch to libstdc++-v3. >How-To-Repeat: The lack of using thread-specific memory produces non-deterministic failures. However, the non-portable (to non-POSIX hosts) code attached will surely crash after some amount of time. >Fix: Patch posted to libstdc++-v3, gcc-patches and installed on mainline. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="g.C" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="g.C" I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cHRocmVhZC5oPgojaW5jbHVkZSA8dW5pc3Rk Lmg+CiAgICAgCiNkZWZpbmUgTl9USFJFQURTIDEwCiAgICAgCnZvaWQgKnggKHZvaWQgKmFyZykK ewogIHdoaWxlICgxKSB7CiAgICB0cnkgewogICAgICB0aHJvdyBpbnQgKCk7CiAgICB9CiAgICBj YXRjaCAoaW50KSB7IH0KICB9Cn0KCnB0aHJlYWRfdCBfX3RbTl9USFJFQURTXTsKCmludAptYWlu IChpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKICBwdGhyZWFkX2F0dHJfdCB0X2F0dHI7CiAgcHRo cmVhZF9hdHRyX2luaXQgKCZ0X2F0dHIpOwogIHB0aHJlYWRfYXR0cl9zZXRkZXRhY2hzdGF0ZSAo JnRfYXR0ciwgUFRIUkVBRF9DUkVBVEVfREVUQUNIRUQpOwogCiAgZm9yIChpbnQgaSA9IDA7IGkg PCBOX1RIUkVBRFM7IGkrKykKICAgICBwdGhyZWFkX2NyZWF0ZSAoJl9fdFtpXSwgJnRfYXR0ciwg eCwgTlVMTCk7CgogIGludCB1cHRpbWUgPSAwOwogIHdoaWxlICgxKSB7CiAgICBzbGVlcCAoMSk7 CiAgICB1cHRpbWUrKzsKICAgIHN0ZDo6Y291dCA8PCAidXB0aW1lOiAiIDw8IHVwdGltZSA8PCAi c2Vjc1xyIiA8PCBzdGQ6OmZsdXNoOwogIH0KfSAK