[llvm-bugs] [Bug 45171] throw of a C string is causing an error when targeting wasm32

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 15 09:42:03 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45171

Quentin Brooks <sliftist at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Quentin Brooks <sliftist at gmail.com> ---
Thanks Heejin for taking a look! I did some more testing and I think my repro
was actually not specific enough.

I think the actual bug is that clang 9 is now using "typeinfo"s for types that
are thrown, where clang 8 did not. My corrected example (works on clang 8,
doesn't on clang 9) would be:

    clang --target=wasm32 -nostdlib -H -Wl,--no-entry -Wl,--allow-undefined
-Wl,--export-dynamic -fvisibility=hidden ./test.cpp

./test.cpp
    extern "C" {
        void* __cxa_allocate_exception(unsigned int thrown_size) { return
nullptr; }
        void __cxa_throw(void* thrown_object, void* type, void(*dest)(void*)) {
}
    }

    __attribute__((visibility("default"))) void testThrow() {
        throw "test";
    }

It seems that if exceptions require "typeinfo for char const*", it should be
moved out of libc++abi and into clang. I feel like exceptions are more part of
the language, and less a standard library thing, but maybe I'm wrong.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200315/e3a5e615/attachment.html>


More information about the llvm-bugs mailing list