From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752696AbcG2KiR (ORCPT ); Fri, 29 Jul 2016 06:38:17 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:62339 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752313AbcG2KiM (ORCPT ); Fri, 29 Jul 2016 06:38:12 -0400 From: Arnd Bergmann To: Borislav Petkov Cc: Linus Torvalds , Ingo Molnar , Michal Marek , Sam Ravnborg , lkml , Michael Matz , Linux Kbuild mailing list , x86-ml Subject: Re: [PATCH] Kbuild: Move -Wmaybe-uninitialized to W=1 Date: Fri, 29 Jul 2016 12:35:57 +0200 Message-ID: <4090105.Iz5p5IbnPA@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-28-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20160729101932.GA27543@nazgul.tnic> References: <20140616132045.GE8170@pd.tnic> <19202646.LtBeEUK5Qq@wuerfel> <20160729101932.GA27543@nazgul.tnic> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:qgmEZqLK/bXRDzgkbin0q+Tbf8Mq563Njzy1QeHKg5nbCulzHj2 tm5me/hTP+0b1Y9kOTydhDE9DUu4mNeouwr1H6hTvpfh2Tga1XHajEjIVDhwdORJN3zeMoa N0cv6+xzKNd5ANWyG81YT31t5RHTyOE54Dz2of04+ui76dTEx5dgVjBGzP9Y8Kng8TgySzl jw0obhOzPs9hCSKxwADGw== X-UI-Out-Filterresults: notjunk:1;V01:K0:AD0c5FVDtks=:cCgcbnbQPzaiKELCkw+6Go 8ppfYBvfX3hnIdmXXYQMb8H7H58xkfuL6A9IgPLBJaso03RA9BlmjrgApGXEKmo1ySKq/21UC U9kgqenAD5XibfiNVc7iP81459tNEIkoUTbgoXh7j8MQT50SjG3djc7izWLvm3bv6l02Klcar gEHfQwHfOhLcVIHxcePrsDkr/uxVyTK/h+png8zXrNIVgPs2vCuBl+bLko8Z9RuHwqCgw6/gS AkSx5WOQFza98Tza5a3mWC3d/Q2UpTzqIjOjlILAKo5gQAP7i5NqXVoM7h4FnUcPQ3tEGJcTz bXGIJggTSznDytxKnWlOr14G9WCExvmoyrCDgrtXMvoch2EiFw7hJ98aWwl04T6Ze2Ee4FIsc XOfBDjZj2BkL2AoXwTUSo1DAhEdHWO3w7xArS9yQ+msBuGc2ylOv0/49c2RfxIwLHdOdSpIDw TiORCvuWFHBrFxgVAT8Sy89GKLI89/XOS+9SRe+Mj/YVRdnLetRSGkSo2gdywAxTM0NK8f/uU /MnTt0LTu7iHJc5APJw49Yg7Y7M5+WXPGXDujxdw05Vbk1xoOX9bKT0iblhtplhK+vRNI8uwQ 20R636Vn+ecjolr0JvQBC+OHlL1y+RYmXCYIIXLdV5D3ci/Ll9kmv0BZ6/Kv0sN27kyCAueLi wQhEAd50Mp0x++/OULeX0lIL7XpSx9iUauMPP9dR+WKZKBHZNJVIm93aAsMd59GFol/fm6OhW ktd15ZFyWGcDw/oq Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, July 29, 2016 12:19:32 PM CEST Borislav Petkov wrote: > On Fri, Jul 29, 2016 at 12:08:51PM +0200, Arnd Bergmann wrote: > > Let me try to get to the bottom of this, maybe we can get the warning > > back in the future. It has found a number of actual bugs. The majority > > of -Wmaybe-uninitialized warnings that I fixed in linux-next were > > false positives (maybe four out of five) but I would think the reason > > So this is exactly the problem: we should not fix perfectly fine code > just so that gcc remains quiet. So when you say "fixed false positives" > you actually mean, "changed it so that gcc -Wmaybe-u... doesn't fire" > right? > > And we should not do that. As I said elsewhere in the mail, in general the code becomes more readable in the process and/or the compiler gets to optimize it better. What typically happens here is that something prevents the compiler from seeing that a condition is always true, so it has to evaluate it at runtime when it should have noticed that it can never hit. If the code is written in a way that the compiler can actually see that the condition is known based on what happened earlier, we save an extra branch, or in some cases duplication of object code. There have been a small number of cases where this was not possible and I actually ended up adding a fake initialization because rearranging the code for the compiler would have made it less readable for humans (e.g. b268c34e5ee92a [1]), but that has been the rare exception because of the reasons that Rusty nicely described in [2]. Arnd [1] https://patchwork.kernel.org/patch/9212881/ [2] https://rusty.ozlabs.org/?p=232