-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda ABI mismatch #141
Comments
I wonder why you can give a lambda with non-empty catch clause to a https://en.cppreference.com/w/cpp/language/lambda#ClosureType::operator.28.29.28params.29
|
The user-defined conversion function to function pointer type shouldn't be used here, because
|
We've previously discussed this here. Our conclusion then appears to have been that we should force lambdas to have internal linkage. Clang seems to have never implemented that; in r151029, Doug Gregor gave lambdas external linkage in the situations where they have a stable mangling. It looks like GCC and ICC are doing the same. So effectively compilers are implementing option 1 from that mailing list post. If compilers aren't going to give lambdas internal linkage in these situations, the ABI needs to define a layout for them. As far as I can tell, Clang, GCC, and ICC are all trying to use the same layout rule: explicit captures are added in declaration order, then implicit captures are added in the source order of their ODR use in the lambda body. The exception which causes this incompatibility is that GCC seems to order implicit |
Code compiled with Clang cannot be linked with GCC due to incompatibilities related to lambda closure capture lists. This patch builds and caches LLVM with Clang to be used with the Clang Release build and with GCC to be used with the GCC Debug build of CIRCT. The ABI issue and a potential fix is being tracked here: itanium-cxx-abi/cxx-abi#141
Code compiled with Clang cannot be linked with GCC due to incompatibilities related to lambda closure capture lists. This patch builds and caches LLVM with Clang to be used with the Clang Release build and with GCC to be used with the GCC Debug build of CIRCT. The ABI issue and a potential fix is being tracked here: itanium-cxx-abi/cxx-abi#141
Code compiled with Clang cannot be linked with GCC due to incompatibilities related to lambda closure capture lists. This patch builds and caches LLVM with Clang to be used with the Clang Release build and with GCC to be used with the GCC Debug build of CIRCT. The ABI issue and a potential fix is being tracked here: itanium-cxx-abi/cxx-abi#141
Compiler inlining of methods which define lambdas leads to issues. If the creation site is inlined and compiled with a separate compiler, the linker can still decide to replace the function with an implementation from another compiler capturing items in a different order. Since the creation site and the lambda implementation do not match, incorrect parameters are passed to the function.
Is this undefined behaviour or an issue with the ABI?
A minimal example to reproduce the error can be found here: https://github.com/nandor/lambda-abi-error
The text was updated successfully, but these errors were encountered: