NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-arm/52509: c++ exceptions broken on earmv7hf (and maybe all arm)



>Number:         52509
>Category:       port-arm
>Synopsis:       c++ exceptions broken on earmv7hf (and maybe all arm)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-arm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 28 10:55:00 +0000 2017
>Originator:     Manuel Bouyer
>Release:        NetBSD 8.0_BETA
>Organization:
>Environment:
System: NetBSD chartplotter 8.0_BETA NetBSD 8.0_BETA (CUBIEBOARD) #0: Thu Aug 24 13:02:21 CEST 2017 bouyer%bop.soc.lip6.fr@localhost:/dsk/l1/misc/bouyer/tmp/earmv7hf/obj/dsk/l1/misc/bouyer/netbsd-8/src/sys/arch/evbarm/compile/CUBIEBOARD evbarm
Architecture: earmv7hf
Machine: evbarm
>Description:
	boost-lib fails to build on earmv7hf, I tracked it down to exceptions
	handling in c++. This small test program, made from boost config tests,
	reproduces it:
	cat > /tmp/conftest.cpp << EOF

//  (C) Copyright John Maddock 2001. 
//  Use, modification and distribution are subject to the 
//  Boost Software License, Version 1.0. (See accompanying file 
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org/libs/config for most recent version.

//  MACRO:         BOOST_NO_EXCEPTIONS
//  TITLE:         exception handling support
//  DESCRIPTION:   The compiler in its current translation mode supports
//                 exception handling.


namespace boost_no_exceptions{

void throw_it(int i)
{
   throw i;
}

int test()
{
   try
   {
      throw_it(2);
   }
   catch(int i)
   {
      return (i == 2) ? 0 : -1;
   }
   catch(...)
   {
      return -1;
   }
   return -1;
}

}

int main(){ return boost_no_exceptions::test(); }
EOF
	
	compile with:
	c++ -o /tmp/conftest -g /tmp/conftest.cpp

	On a x86_64 8.0_BETA host, this gives:
>/tmp/conftest 
>echo $status 
0

	but on earmv7hf:
>/tmp/conftest
terminate called after throwing an instance of 'int'
terminate called recursively
Abort
>echo $status 
134

	gdb shows:
(gdb) where
#0  0x70c9133c in _lwp_kill () from /usr/lib/libc.so.12
#1  0x70c88780 in abort () from /usr/lib/libc.so.12
#2  0x70dccd24 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/libstdc++.so.7
#3  0x70dd69b8 in __cxxabiv1::__terminate(void (*)()) ()
   from /usr/lib/libstdc++.so.7
#4  0x70dd6a54 in std::terminate() () from /usr/lib/libstdc++.so.7
#5  0x70dd699c in __cxa_rethrow () from /usr/lib/libstdc++.so.7
#6  0x70dccd30 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/libstdc++.so.7
#7  0x70dd69b8 in __cxxabiv1::__terminate(void (*)()) ()
   from /usr/lib/libstdc++.so.7
#8  0x70dd6a54 in std::terminate() () from /usr/lib/libstdc++.so.7
#9  0x70dd691c in __cxa_throw () from /usr/lib/libstdc++.so.7
#10 0x000108b0 in boost_no_exceptions::throw_it (i=2) at /tmp/conftest.cpp:18
#11 0x000108c8 in boost_no_exceptions::test () at /tmp/conftest.cpp:25
#12 0x00010950 in main () at /tmp/conftest.cpp:44


>How-To-Repeat:
	see above
>Fix:
	unknown, the problem seems to be in libstdc++



Home | Main Index | Thread Index | Old Index