From owner-freebsd-current@freebsd.org Sun Dec 4 09:52:56 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EC14C66573 for ; Sun, 4 Dec 2016 09:52:56 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 543381C1A for ; Sun, 4 Dec 2016 09:52:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id A10B11FE158; Sun, 4 Dec 2016 10:52:47 +0100 (CET) Subject: Re: clang/llvm 3.9.0 mysteriously zeroing variables? To: Colin Percival , freebsd-current@freebsd.org References: <01000158c7252f0c-6c3198b0-fbef-4a60-ade9-e3b91d9e83bd-000000@email.amazonses.com> From: Hans Petter Selasky Message-ID: Date: Sun, 4 Dec 2016 10:52:23 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <01000158c7252f0c-6c3198b0-fbef-4a60-ade9-e3b91d9e83bd-000000@email.amazonses.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 04 Dec 2016 09:52:56 -0000 On 12/04/16 01:04, Colin Percival wrote: > Starting with r309124 (when clang/llvm 3.9.0 was imported) I'm seeing EC2 > instances panic on boot with a division-by-zero error; the code in question > is in blkfront.c, printing out the size of disks: > >> device_printf(dev, "%juMB <%s> at %s", >> (uintmax_t) sectors / (1048576 / sector_size), >> device_get_desc(dev), >> xenbus_get_node(dev)); > > My first thought was that 'sector_size' must be either zero or very large... > but no, when I add printf("sector_size = %ju\n", (uintmax_t)sector_size), it's > entirely normal. What's more, adding that printf makes the division-by-zero > panic go away. > > I'd think I was just hallucinating, but earlier today I heard that a similarly > "impossible" panic had been observed in the NFS client code when compiled with > clang/llvm 3.9.0. > > So... is anyone else seeing unexpected panics or other odd behaviour starting > after clang/llvm 3.9.0 was imported? > Hi, Can you look at the code with "objdump -Dx --source" and see what is going on there? Might it be the "sector" variable is shadowed? --HPS