https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61265

--- Comment #3 from Chris Manghane <cmang at google dot com> ---
Sorry for the noise, responding with new information as I discover it.

The above patch doesn't really work (it fails a few tests) because this isn't a
problem with zero-sized array types, but rather a problem with zero-sized
elements in array types.

This same bug can be reproduced by

package main

var a = [1]struct{}{B}[0]
var B = struct{}{}

func main(){}

because struct{} is a zero-sized type and the backend implementation makes
assumptions about zero-sized globals for the linker. A better approach is to
just avoid constructing an array of zero-sized values and evaluate the
zero-valued expressions for their side effects. This is be done in
https://codereview.appspot.com/191970043/.

Reply via email to