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

            Bug ID: 40412
           Summary: Unconvertable type leads to invalid WebAssembly
           Product: libraries
           Version: trunk
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedb...@nondot.org
          Reporter: dan433...@gmail.com
                CC: llvm-bugs@lists.llvm.org

On this C++ testcase:


class c;

template<class> class basic_streambuf {
  virtual c seekoff(unsigned);
};

basic_streambuf<char> x;


Clang produces LLVM IR for wasm32 containing this:

@_ZTV15basic_streambufIcE = linkonce_odr hidden unnamed_addr constant { [3 x
i8*] } { [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }*
@_ZTI15basic_streambufIcE to i8*), i8* bitcast (void ()*
@_ZN15basic_streambufIcE7seekoffEj to i8*)] }, comdat, align 4

declare void @_ZN15basic_streambufIcE7seekoffEj() unnamed_addr


seekoff's argument types don't match the types in the C++ source file, which
causes wasm-ld to ultimately complain about the signature mismatch.

This is a reduced form of code in libcxx which causes wasm-ld to complain when
linking C++ programs:

wasm-ld: warning: function signature mismatch:
_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7seekoffExNS_8ios_base7seekdirEj
>>> defined as (i32, i32, i64, i32, i32) -> void in [...]/libc++.a(ios.cpp.obj)
>>> defined as () -> void in [...]/libc++.a(iostream.cpp.obj)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to