This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Make clang emit correct va_arg code for structs
ClosedPublic

Authored by quantum on Aug 13 2019, 2:06 PM.

Details

Summary

In the WebAssembly backend, when lowering variadic function calls, non-single
member aggregate type arguments are always passed by pointer.

However, when emitting va_arg code in clang, the arguments are instead read as
if they are passed directly. This results in the pointer being read as the
actual structure.

Fixes https://github.com/emscripten-core/emscripten/issues/9042.

Diff Detail

Repository
rL LLVM

Event Timeline

quantum created this revision.Aug 13 2019, 2:06 PM
dschuff accepted this revision.Aug 13 2019, 2:14 PM

LGTM. Nice that we had a test which tested the wrong thing.

This revision is now accepted and ready to land.Aug 13 2019, 2:14 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2019, 2:41 PM