[turboshaft] Fix compilation with gcc

gcc versions < 9 may produce the following compilation error due
to passing/initializing an empty struct as a parameter:
> '<anonymous>' is used uninitialized in this function

A reproducible code sample can be seen here:
https://godbolt.org/z/PfanPrEGG

This issues seems to have come up in gcc in various ways,
here is a related bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86465

A simple workaround here it to add a 0 initialized value to
the empty struct.

More information can be found at the comment section of this CL: crrev.com/c/4057111

Bug: v8:12783
Change-Id: Iee8fec73610fa2525530db431daf5fa285c09a3f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4097624
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#84795}
This commit is contained in:
Milad Fa 2022-12-12 11:21:57 -05:00 committed by V8 LUCI CQ
parent 7b381dfef6
commit 50961e7032

View File

@ -52,7 +52,17 @@ struct TypeForBits<64> {
std::numeric_limits<float_type>::quiet_NaN();
};
struct Payload_Empty {};
// gcc versions < 9 may produce the following compilation error:
// > '<anonymous>' is used uninitialized in this function
// if Payload_Empty is initialized without any data, link to a relevant bug:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86465
// A workaround is to add a dummy value which is zero initialized by default.
// More information as well as a sample reproducible code can be found at the
// comment section of this CL crrev.com/c/4057111
// TODO: Remove dummy once all platforms are using gcc >= 9.
struct Payload_Empty {
uint8_t dummy = 0;
};
template <typename T>
struct Payload_Range {