Go patch committed: Fix passing zero-sized global variable to function
Andrew Pinski
pinskia@gmail.com
Tue Dec 22 00:19:00 GMT 2015
On Mon, Dec 21, 2015 at 4:10 PM, Ian Lance Taylor <iant@golang.org> wrote:
> The GNU linker doesn't support a zero-sized global variable that is
> dynamically exported, so gccgo generates those global variables with a
> size of 1 byte. Unfortunately, that means that passing a global
> variable to a function that takes an argument of a zero-sized type
> will actually pass 1 byte, taking up an argument slot, rather than a
> zero-sized argument that should be skipped. This patch fixes the
> problem in the Go frontend -> GCC interface by adding a conversion to
> the real type for any such global variables, and undoing the
> conversion where necessary. Bootstrapped and ran Go testsuite on
> x86_64-pc-linux-gnu. Committed to mainline and gccgo branch.
VIEW_CONVERT_EXPR on different size types is invalid for GCC's IR.
So this patch cause other issues.
Thanks,
Andrew Pinski
>
> Ian
>
> 2015-12-21 Ian Lance Taylor <iant@google.com>
>
> * go-gcc.cc (Gcc_backend::global_variable): If type is zero-sized,
> add a VIEW_CONVERT_EXPR to the tree.
> (Gcc_backend::global_variable_set_init): Remove any
> VIEW_CONVERT_EXPR.
> (Gcc_backend::write_global_definitions): Likewise.
More information about the Gcc-patches
mailing list