From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH] hfsplus: fix warnings in fs/hfsplus/bfind.c: In function 'hfs_find_1st_rec_by_cnid' Date: Fri, 8 Mar 2013 14:29:29 -0800 Message-ID: <20130308142929.fd24d05b529d420fd7beaf1e@linux-foundation.org> References: <1362324385.29435.31.camel@slavad-ubuntu-12.04> <20130307111832.ba5844ce385220fdd57723c0@linux-foundation.org> <0AC1048B-F0AB-47BF-A1E9-16125F127D60@dubeyko.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Christoph Hellwig , Al Viro , Hin-Tak Leung , Fengguang Wu To: Vyacheslav Dubeyko Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:50782 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932158Ab3CHW3b (ORCPT ); Fri, 8 Mar 2013 17:29:31 -0500 In-Reply-To: <0AC1048B-F0AB-47BF-A1E9-16125F127D60@dubeyko.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, 8 Mar 2013 16:15:48 +0300 Vyacheslav Dubeyko wrote: > > I don't see that warning. Whatever gcc you're using appears to be > > mishandling unreachable(). Please provide details? > > > > The warning is reproducible with special kernel configuration (please, see attached configuration file). # CONFIG_BUG is not set Erk yes, CONFIG_BUG=n causes a ton of problems. But in the case of x86, it should still work OK: #define BUG() \ do { \ asm volatile("ud2"); \ unreachable(); \ } while (0) But the problem is that the above code is dependent upon both CONFIG_BUG and CONFIG_DEBUG_BUGVERBOSE. If both these are unset then we get the stupid implementation, from include/asm-generic/bug.h: #ifndef HAVE_ARCH_BUG #define BUG() do {} while(0) #endif ie: the kernel silently locks up. I think it would be better if x86 were to provide the "ud2" version of BUG() when CONFIG_BUG=n, as well as when CONFIG_DEBUG_BUGVERBOSE=n. That would probably generate less code than the daft include/asm-generic/bug.h implementation anyway. As for why you got those warnings: gcc bug, IMO. If the compiler sees int x; do { } while (0); wibbles(x); then it should have brains to not tell us that x is used-unintialised. Sigh. I'm not particularly enthused about fixing CONFIG_BUG=n stuff. It's a nuisance.