On 12/19/2017 01:58 PM, Richard Smith wrote:
On 18 Dec 2017 15:23, "Stephan Bergmann via cfe-commits" <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> wrote:

    On 12/18/2017 03:05 PM, Richard Smith wrote:

        Can we just strip the noexcept from the function type before
        emitting the fsan type info?


    As is apparently already done when emitting the (not
    noexcept-annotated) __cxxabiv1::__function_type_info referenced from
    a noexcept-annotated __cxxabiv1::__pointer_type_info?

    That would indeed look like a better way to address this, then.  But
    wouldn't that also prevent -fsanitize=function from finding
    mismatches where a non-noexcept function is called through a
    noexcept pointer, as in

       void f() {}
       void g(void (*p)() noexcept) { p(); }
       int main() { g(reinterpret_cast<void (*)() noexcept>(f)); }


That call seems OK to me; if the function does throw, std::terminate() will be called.

I would have assumed that should be UB. But that arguably could depend on whether and how that DR about calling noexpect functions through non-noexcept pointers that both you and I reported will be resolved. (It's a bit unfortunate that no information about those DR filings is yet available at <http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html>.)

One more argument in favour of resolving this issue as per <https://reviews.llvm.org/D40720#958730> for now. So I'll look into that.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to