From d795777ce47faffdbbd7a03d44c05b88939dc3e2 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 10 Mar 2026 14:16:53 +0100 Subject: [PATCH 1/2] Updated compiler 41 test, handle the exception thrown correctly --- ACE/tests/Compiler_Features_41_Test.cpp | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/ACE/tests/Compiler_Features_41_Test.cpp b/ACE/tests/Compiler_Features_41_Test.cpp index c9e71d0da34b6..7b7ad163f5741 100644 --- a/ACE/tests/Compiler_Features_41_Test.cpp +++ b/ACE/tests/Compiler_Features_41_Test.cpp @@ -22,34 +22,46 @@ run_main (int, ACE_TCHAR *[]) #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS) bool finally_executed = false; + bool except_executed = false; - ACE_DEBUG ((LM_DEBUG,("Testing __try/__finally\n"))); + ACE_DEBUG ((LM_DEBUG,("Testing __try/__except/__finally\n"))); ACE_SEH_TRY + { + ACE_DEBUG ((LM_DEBUG, ("In outer SEH_TRY\n"))); + + ACE_SEH_TRY { - ACE_DEBUG ((LM_DEBUG,("In SEH_TRY\n"))); + ACE_DEBUG ((LM_DEBUG, ("In inner SEH_TRY\n"))); // Intentionally cause an access violation exception, use a helper function // as non-call SEH isn't supported with clang based windows compilers - test(); + test (); // If we get here without an exception, SEH isn't working ACE_ERROR ((LM_ERROR, "No exception was raised from null pointer dereference\n")); result = -1; } - ACE_SEH_FINALLY + ACE_SEH_FINALLY { - ACE_DEBUG ((LM_DEBUG,("In SEH_FINALLY\n"))); + ACE_DEBUG ((LM_DEBUG, ("In inner SEH_FINALLY\n"))); finally_executed = true; // If we're here due to an exception, that's the expected behavior - test passes } + } + ACE_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) + { + ACE_DEBUG ((LM_DEBUG, ("In outer SEH_EXCEPT\n"))); + except_executed = true; + } ACE_DEBUG ((LM_DEBUG,("After SEH_FINALLY\n"))); // On successful SEH handling: // 1. The null pointer dereference should raise an exception // 2. The FINALLY block should execute - // 3. Execution should continue after the SEH blocks + // 3. The EXCEPT block should be executed + // 4. Execution should continue after the SEH blocks if (finally_executed) { ACE_DEBUG ((LM_DEBUG, "SEH test passed - FINALLY block was executed\n")); @@ -59,6 +71,15 @@ run_main (int, ACE_TCHAR *[]) ACE_ERROR ((LM_ERROR, "SEH test failed - FINALLY block was not executed\n")); result = -1; } + if (except_executed) + { + ACE_DEBUG ((LM_DEBUG, "SEH test passed - EXCEPT block was executed\n")); + } + else + { + ACE_ERROR ((LM_ERROR, "SEH test failed - EXCEPT block was not executed\n")); + result = -1; + } #else ACE_DEBUG ((LM_INFO, ACE_TEXT ("Platform lacks ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS\n"))); From 3ea48644c41b13b2a38c8886f08b32b715eb98c5 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 10 Mar 2026 14:32:46 +0100 Subject: [PATCH 2/2] Update Compiler_Features_41_Test.cpp --- ACE/tests/Compiler_Features_41_Test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/tests/Compiler_Features_41_Test.cpp b/ACE/tests/Compiler_Features_41_Test.cpp index 7b7ad163f5741..6478a98aa2f92 100644 --- a/ACE/tests/Compiler_Features_41_Test.cpp +++ b/ACE/tests/Compiler_Features_41_Test.cpp @@ -49,7 +49,7 @@ run_main (int, ACE_TCHAR *[]) // If we're here due to an exception, that's the expected behavior - test passes } } - ACE_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) + ACE_SEH_EXCEPT (GetExceptionCode () == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { ACE_DEBUG ((LM_DEBUG, ("In outer SEH_EXCEPT\n"))); except_executed = true;