From owner-freebsd-current@FreeBSD.ORG Fri Jan 2 09:07:23 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7866DB8E; Fri, 2 Jan 2015 09:07:23 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 43C8566E49; Fri, 2 Jan 2015 09:07:22 +0000 (UTC) Received: from [192.168.0.7] (cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61]) (authenticated bits=0) by theravensnest.org (8.15.1/8.14.9) with ESMTPSA id t0297IIZ054517 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Jan 2015 09:07:20 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61] claimed to be [192.168.0.7] Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: asr(4) error with new clang/llvm From: David Chisnall In-Reply-To: Date: Fri, 2 Jan 2015 09:07:13 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <564797DC-A60F-4335-BF74-B8DB4B3AFACA@FreeBSD.org> References: <54A61AFD.3040507@multiplay.co.uk> To: Ed Maste X-Mailer: Apple Mail (2.1993) Cc: FreeBSD Current , Steven Hartland X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jan 2015 09:07:23 -0000 On 2 Jan 2015, at 05:00, Ed Maste wrote: >=20 > It's a variable length array in a struct / union. Other than being > confusing and now triggering a warning after the clang update it > should be fine. >=20 > Most likely we need to build asr with -Werror disabled for that > warning, perhaps -Wno-error-array-bounds. I'll take a look tomorrow > morning if nobody else gets to it first. The correct solution is to declare the array to have 0 elements = (although this will break C++ code). A zero-length array at the end of = a structure is specifically defined by the C standard (since C99) to be = a variable-length array. A length-one array was used in C89 prior to = this for this purpose. Using a 1-element array in C is undefined = behaviour. Note that this change will also require fixing code that allocates it to = allocate space for n elements not n-1. David