Received: from eggs.gnu.org ([2001:4830:134:3::10]:55653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKVzt-0000fI-Vi for qemu-devel@nongnu.org; Sat, 16 Jan 2016 13:54:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKVzp-0006ja-1A for qemu-devel@nongnu.org; Sat, 16 Jan 2016 13:54:49 -0500 Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]:33380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKVzo-0006jW-S8 for qemu-devel@nongnu.org; Sat, 16 Jan 2016 13:54:44 -0500 Received: by mail-io0-x22e.google.com with SMTP id q21so516434746iod.0 for ; Sat, 16 Jan 2016 10:54:44 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <56998731.8080307@redhat.com> Date: Sat, 16 Jan 2016 13:54:41 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <1ACE616D-2B38-4274-8E77-483A4CCEEE91@gmail.com> References: <56998731.8080307@redhat.com> Subject: Re: [Qemu-devel] bug with io/channel-socket.c - variable-sized object may not be initialized List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel qemu-devel On Jan 15, 2016, at 6:56 PM, Eric Blake wrote: > On 01/13/2016 02:19 PM, Programmingkid wrote: >> This code causes an error to occur during compiling:=20 >>=20 >> char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] =3D { 0 }; >>=20 >> It is located at line 496 in io/channel-socket.c.=20 >>=20 >> Here is the full error message: >> io/channel-socket.c: In function 'qio_channel_socket_writev': >> io/channel-socket.c:496:18: error: variable-sized object may not be = initialized >> char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] =3D { 0 }; >>=20 >> This is from gcc 4.9 running on Mac OS 10.6.8.=20 >=20 > Uggh. That sounds like a bug in the Mac OS headers, for making > CMSG_SPACE() not be a compile-time constant. We do NOT want to be = using > variable-sized objects here, so we need a compile-time constant for = the > array size, even if we have to work around your platform's borked = headers. > Can you capture what that line expands to after pre-processing, to see > if my guess is right? It expands to 76.=20