Issue Details (XML | Word | Printable)

Key: STDCXX-643
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Travis Vitek
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

[IBM XLC++/AIX] std::exception incompatible with runtime library

Created: 02/Nov/07 10:27 PM   Updated: 11/Jul/09 12:07 AM
Return to search
Component/s: 19. Diagnostics
Affects Version/s: 4.2.0
Fix Version/s: 5.0.0

Time Tracking:
Not Specified

Environment: IBM XLC++/AIX
Issue Links:
Blocker
 

Severity: Binary Incompatibility


 Description  « Hide
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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Travis Vitek made changes - 02/Nov/07 10:31 PM
Field Original Value New Value
Severity Incorrect Behavior Binary Incompatibility
Martin Sebor made changes - 02/Nov/07 11:50 PM
Link This issue blocks STDCXX-644 [ STDCXX-644 ]
Travis Vitek made changes - 27/Mar/08 07:33 AM
Comment [ I've already suggested that we try to determine, at configuration time, the size and layout of the exception classes so that we can emulate them. If we don't go that far, we should at least add something that will check that the sizes match up and force the library to not compile if they don't. Something like this...

{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)

  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 we would put something like this near the top of exception.cpp

{noformat}
_RWSTD_NAMESPACE (__rw) {

static void
__rw_exception_compile_asserts ()
{
#define TEST(s,t) _RWSTD_COMPILE_ASSERT (s == sizeof (t))
  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);
#undef TEST
}

} // namespace rw
{noformat} ]
Travis Vitek made changes - 27/Mar/08 07:34 AM
Comment [ I have already suggested that we determine the size and layout of the exception classes, and that we emulate them in our implementation. If we don't do that, then at the very least we should do a configuration test and a compile assert. That way the library won't build if our implementation doesn't match the runtime library. I would hope that something like this would work.

{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)

  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}

And then, near the bottom of <exception>, we would write

{noformat}
_RWSTD_NAMESPACE (__rw) {

// used only to guarantee that we are binary compatible with the runtime library
inline void
__rw_exception_compile_asserts ()
{
  _RWSTD_COMPILE_ASSERT (_RWSTD_EXCEPTION_SIZE == sizeof (_STD::exception));
  _RWSTD_COMPILE_ASSERT (_RWSTD_BAD_ALLOC_SIZE == sizeof (_STD::bad_alloc));
  _RWSTD_COMPILE_ASSERT (_RWSTD_BAD_CAST_SIZE == sizeof (_STD::bad_cast));
  _RWSTD_COMPILE_ASSERT (_RWSTD_BAD_EXCEPTION_SIZE == sizeof (_STD::bad_exception));
  _RWSTD_COMPILE_ASSERT (_RWSTD_BAD_TYPEID_SIZE == sizeof (_STD::bad_typeid));
}

} // namespace rw
{noformat}
]
Martin Sebor made changes - 27/Mar/08 09:20 PM
Environment AIX IBM XLC++/AIX
Summary std::exception declaration incompatible with implementation provided by runtime library on AIX [IBM XLC++/AIX] std::exception incompatible with runtime library
Martin Sebor made changes - 17/Jul/08 11:54 PM
Assignee Travis Vitek [ vitek ]
Travis Vitek made changes - 11/Jul/09 12:07 AM
Assignee Travis Vitek [ vitek ]