From owner-freebsd-current@FreeBSD.ORG Fri Jan 2 05:00:34 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9ABFB5A9 for ; Fri, 2 Jan 2015 05:00:34 +0000 (UTC) Received: from mail-ie0-x22d.google.com (mail-ie0-x22d.google.com [IPv6:2607:f8b0:4001:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 584692210 for ; Fri, 2 Jan 2015 05:00:34 +0000 (UTC) Received: by mail-ie0-f173.google.com with SMTP id y20so16341859ier.32 for ; Thu, 01 Jan 2015 21:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=03MrweF8seI/kbyLZ/3+VvWA4sLfs61+atcMHnAkat8=; b=y03GZ4kYF9JADs2CXA/9Yztr5B5YMECZyKxOWHFBkQC+7Mp0Tz7I82vGxjmptP1bBp lwl7B5Z11TPlY9xHUjRDwBJFhWshRtWgUmYi4tbtepVY9Q0Pp2AddIh2vOMmSI/Qd7PT h8i7G6SWV4jb28ydD4UHPmQkoDQuqXO7RXmnErSI2D/1sjYC2jUeJLriFV6dOsJbJ+Hh JSXs5BEb33UbCXr2nIZxNyTyy8cUsFmXcESKyErIC0NWVmTAinWXQf8viSY/ExmBHNrD 7FeZaj4wvkqYlgNLGz4pGinttWRAuOTK3aQk3SUHkIcsR9YLBqbedTCP+x9OIj3sZuVJ 6hCg== X-Received: by 10.42.78.208 with SMTP id o16mr55199761ick.41.1420174833381; Thu, 01 Jan 2015 21:00:33 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.0.85 with HTTP; Thu, 1 Jan 2015 21:00:13 -0800 (PST) In-Reply-To: <54A61AFD.3040507@multiplay.co.uk> References: <54A61AFD.3040507@multiplay.co.uk> From: Ed Maste Date: Fri, 2 Jan 2015 00:00:13 -0500 X-Google-Sender-Auth: Rns79Qq7P3RFn7lNifWbBLuIoQE Message-ID: Subject: Re: asr(4) error with new clang/llvm To: Steven Hartland Content-Type: text/plain; charset=UTF-8 Cc: FreeBSD Current 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 05:00:34 -0000 On 1 January 2015 at 23:13, Steven Hartland wrote: > > On 02/01/2015 01:23, Bjoern A. Zeeb wrote: >> >> Hi, >> >> you need the next line of source to see that while the union only defines >> Simple[1], the comparison goes up to SG_LIST (or something) which is indeed >> defined as 58. Cn someone fix this? This makes i386 compiles failing >> currently. >> >> /scratch/tmp/bz/head.svn/sys/modules/asr/../../dev/asr/asr.c:1849:29: >> error: array index 58 is past the end of the array (which contains 1 >> element) [-Werror,-Warray-bounds] >> while ((len > 0) && (sg < &((PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE) >> ^ >> /scratch/tmp/bz/head.svn/sys/dev/asr/i2omsg.h:934:8: note: array 'Simple' >> declared here >> I2O_SGE_SIMPLE_ELEMENT Simple[1]; >> ^ > > If that's wrong it looks like there's also a number of calls to the macro > SG(SGL,Index,Flags,Buffer,Size) which are also wrong as Index is used in > the same way: > &(((PI2O_SG_ELEMENT)(SGL))->u.Simple[Index] > > There appears to be two calls to SG where Index is 1. > > I'm afraid I have no idea what the fix would be as the entire driver is very > voodoo like to me :( 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. 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.