Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Feb 2016 06:41:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 207325] projects/clang380-import for TARGET_ARCH=powerpc : c++ exceptions cause SEGV (9 line program)
Message-ID:  <bug-207325-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207325

            Bug ID: 207325
           Summary: projects/clang380-import for TARGET_ARCH=3Dpowerpc : c++
                    exceptions cause SEGV (9 line program)
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: ppc
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: markmi@dsl-only.net

When run the following 9 or so program compiled by clang 3.8.0 (from
project/clang380import -r295601) for TARGET_ARCH=3Dpowerpc gets a SEGV:

#include <exception>

int main(void)
{
    try { throw std::exception(); }
    catch (std::exception& e) {} // same result without &
    return 0;
}

(This simplifies what I found in trying to build and use some ports. For
example, it blocks using "kyua test -k /usr/tests/Kyuafile", which gets a S=
EGV
and aborts.)

# clang++ -g -std=3Dc++11 -Wall -Wpedantic exception_test.cpp
# ./a.out
Segmentation fault (core dumped)

Trying under gdb:
. . .
(gdb) run
Starting program: /root/c_tests/a.out=20

Program received signal SIGSEGV, Segmentation fault.
_Unwind_GetGR (context=3D0xffffd5a0, index=3D<optimized out>) at
/usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-dw2.c:177
177         return * (_Unwind_Ptr *) ptr;
(gdb) bt
#0  _Unwind_GetGR (context=3D0xffffd5a0, index=3D<optimized out>) at
/usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-dw2.c:177
#1  _Unwind_GetPtr (context=3D0xffffd5a0, index=3D<optimized out>) at
/usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-dw2.c:188
#2  uw_update_context (context=3D0xffffd5a0, fs=3D0xffffd0e0) at
/usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind-dw2.c:1370
#3  _Unwind_RaiseException (exc=3D<optimized out>) at
/usr/src/gnu/lib/libgcc/../../../contrib/gcc/unwind.inc:126
#4  0x4192970c in throw_exception (ex=3D<optimized out>) at
/usr/src/lib/libcxxrt/../../contrib/libcxxrt/exception.cc:751
#5  __cxa_throw (thrown_exception=3D<optimized out>, tinfo=3D<optimized out=
>,
dest=3D<optimized out>) at
/usr/src/lib/libcxxrt/../../contrib/libcxxrt/exception.cc:778
#6  0x00000000 in ?? ()

Context details:

# freebsd-version -ku; uname -aKU
11.0-CURRENT
11.0-CURRENT
FreeBSD FBSDG4C1 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r295601M: Sun Feb 14
15:49:49 PST 2016=20=20=20=20
markmi@FreeBSDx64:/usr/obj/clang_gcc421/powerpc.powerpc/usr/src/sys/GENERIC=
vtsc-NODEBUG
 powerpc 1100097 1100097

buildkernel is via gcc 4.2.1
buildworld is via clang 3.8.0

(I've been experimenting with and submitting issues from this environment, =
an
arm
rip2 environment (clang 3.8.0 for both buildworld and buildkernel), and
powerpc64 (via powerpc64-gcc, not clang). So there are some fixes/workaroun=
ds
for various issues in my environment.)

# svnlite status /usr/src/
?       /usr/src/.snap
M       /usr/src/contrib/libc++/include/__config
M       /usr/src/contrib/libcxxrt/guard.cc
M       /usr/src/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
M       /usr/src/lib/csu/powerpc64/Makefile
?       /usr/src/restoresymtable
?       /usr/src/sys/arm/conf/RPI2-NODBG
M       /usr/src/sys/boot/ofw/Makefile.inc
M       /usr/src/sys/boot/powerpc/Makefile
M       /usr/src/sys/boot/powerpc/Makefile.inc
M       /usr/src/sys/boot/uboot/Makefile.inc
M       /usr/src/sys/conf/Makefile.powerpc
M       /usr/src/sys/conf/kern.mk
M       /usr/src/sys/conf/kmod.mk
?       /usr/src/sys/powerpc/conf/GENERIC64-NODBG
?       /usr/src/sys/powerpc/conf/GENERIC64vtsc
?       /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODEBUG
?       /usr/src/sys/powerpc/conf/GENERICvtsc
?       /usr/src/sys/powerpc/conf/GENERICvtsc-NODEBUG
M       /usr/src/sys/powerpc/ofw/ofw_machdep.c
M       /usr/src/sys/powerpc/powerpc/exec_machdep.c

For TARGET_ARCH=3Dpowerpc the signal delivery has a "red zone" added to dea=
l with
clang 3.8.0 moving the stack pointer late on entry to functions and early on
exit from functions compared to the ABI. And there is a va_arg fix for
va_list's gpr and fpr value handling to be sure the overflow area is used w=
hen
it should be. There is tracking of command line option changes.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-207325-8>