|
From: SF/projects/mingw n. l. <min...@li...> - 2013-01-11 17:30:15
|
Bugs item #830692, was opened at 2003-10-26 14:23 Message generated for change (Comment added) made by earnie You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=830692&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: non-mingw >Group: Aged issue >Status: Closed >Resolution: Out of Date Priority: 5 Private: No Submitted By: Shura Zam (debil_urod) Assigned to: Nobody/Anonymous (nobody) Summary: Local object don`t destroyed when longjmp call Initial Comment: Local object don`t destroyed when longjmp call I tested it by Os WinXP g++ (GCC) 3.2.3 (mingw special 20030504-1) =====longjmp.cpp===== #include <iostream> #include <setjmp.h> using std::cout; using std::endl; jmp_buf jmpb; struct ex_test { ex_test(const char* msg); ~ex_test(); private: const char* msg; };//ex_test ex_test::ex_test(const char* msg) : msg(msg) { cout<<"ex_test::ex_test(char*): "<<msg<<endl; } ex_test::~ex_test() { cout<<"ex_test::~ex_test(): "<<msg<<endl; } void jmp() { static const char* msg = "3 jamp raised"; ex_test _(msg); longjmp(jmpb, 1); } void test() { static const char* msg = "2 jamp test"; ex_test _(msg); jmp(); } int main() { if (!setjmp(jmpb)) { static const char* msg = "1 set jamp buf"; ex_test _(msg); test(); } else { static const char* msg = "4 jamp from buf"; ex_test _(msg); } return 0; } =====command line======= c:\g++ -Wall -olongjmp longjmp.cpp c:\longjmp.exe =====output============ ex_test::ex_test(char*): 1 set jamp buf ex_test::ex_test(char*): 2 jamp test ex_test::ex_test(char*): 3 jamp raised ex_test::ex_test(char*): 4 jamp from buf ex_test::~ex_test(): 4 jamp from buf =====output============ Destructor call only one object of four. This conflict by ISO/IEC:14882 #18.7/4 ---------------------------------------------------------------------- >Comment By: Earnie Boyd (earnie) Date: 2013-01-11 09:30 Message: If this is still an issue please take the concern to the GCC or binutils bugs frameworks. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=830692&group_id=2435 |