[
https://issues.apache.org/jira/browse/STDCXX-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582529#action_12582529
]
Travis Vitek commented on STDCXX-643:
-------------------------------------
I suggested trying to determine the size of the runtime library std::exception
object and then mimic that in our implementation, but that was shot down. If we
aren't going to try to determine the size/layout at compile time, then at the
very least we need to do something to prevent this from happening on other
platforms.
One option would be to add a test to verifiy this problem isn't happening. A
normal regression type test would work, but might not be in-your-face enough to
ensure that it is fixed before a release. I'm thinking that a compile assert in
<exception> and a configuration test to collect the size of of the exception
object used by the runtime library is one way.
{noformat}
// looking for runtime library exceptions
#include <exception>
#include <typeinfo>
#include <stdio.h>
template <class T>
void run_test (const char* s)
{
printf ("#define %-18s %u\n", s, sizeof (T));
}
int main ()
{
#define TEST(s,t) run_test<t>(s)
// bad_alloc, bad_cast, bad_exception, and bad_typeid
TEST ("_RWSTD_EXCEPTION_SIZE" , std::exception);
TEST ("_RWSTD_BAD_ALLOC_SIZE" , std::bad_alloc);
TEST ("_RWSTD_BAD_CAST_SIZE" , std::bad_cast);
TEST ("_RWSTD_BAD_EXCDEPTION_SIZE", std::bad_exception);
TEST ("_RWSTD_BAD_TYPEID_SIZE" , std::bad_typeid);
return 0;
}
{noformat}
Then, somewhere near the bottom of our <exception> header...
{noformat}
_RWSTD_COMPILE_ASSERT (_RWSTD_EXCEPTION_SIZE == sizeof (std::exception))
_RWSTD_COMPILE_ASSERT (_RWSTD_EXCEPTION_SIZE == sizeof (std::exception))
> std::exception declaration incompatible with implementation provided by
> runtime library on AIX
> ----------------------------------------------------------------------------------------------
>
> Key: STDCXX-643
> URL: https://issues.apache.org/jira/browse/STDCXX-643
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 19. Diagnostics
> Affects Versions: 4.2.0
> Environment: AIX
> Reporter: Travis Vitek
> Fix For: 5.0
>
>
> A description of the problem is available here.
> http://www.nabble.com/19.exceptions.mt.cpp-fails-on-AIX-tf4738595.html
> Essentially we need to add a const char* member to std::exception for AIX.
> Unfortunately the fix is a binary incompatible with previous versions of
> stdcxx.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.