On Mon, Dec 21, 2015 at 4:19 PM, Andrew Pinski <pins...@gmail.com> wrote:
> On Mon, Dec 21, 2015 at 4:10 PM, Ian Lance Taylor <i...@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.

Hmmm, thanks for the pointer.  Any suggestions?  The constraints are
that the variable has to be non-zero sized (or the GNU linker
complains) and I can't entirely drop the reference to the variable (or
the linker might fail to pull in an object from an archive) and the
resulting expression has to be zero-sized (or the function call is
miscompiled).

ian

Reply via email to