From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA5BC433EF for ; Thu, 14 Apr 2022 20:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346316AbiDNUdW (ORCPT ); Thu, 14 Apr 2022 16:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240868AbiDNUdU (ORCPT ); Thu, 14 Apr 2022 16:33:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3BB8AAC94 for ; Thu, 14 Apr 2022 13:30:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 597A2B82984 for ; Thu, 14 Apr 2022 20:30:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 741C7C385A1; Thu, 14 Apr 2022 20:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1649968252; bh=F2sUCe9gi4kdAwiM+xd38Vkiw3sg5LfikwjEod6T5no=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=q5F4ba7EW90B8hMcPBLkQdGZLNF5JCeKwv0NHSuDHMXFMJEnW8CWNaqRStzcHyJUn 3kpUYKCn7E/ZRHyMF675pgeheJvViUCQvqn6mGJ5CxSqXwAQKgK7rRXqVFkfIkzA/q 6x3lGssjUCKjaeI0vsKoavc0sJLRCPyYhNZs+lHg= Date: Thu, 14 Apr 2022 13:30:50 -0700 From: Andrew Morton To: Peter Zijlstra Cc: Christophe de Dinechin , trivial@kernel.org, Ben Segall , "Michael S. Tsirkin" , Steven Rostedt , Ingo Molnar , Mel Gorman , Dietmar Eggemann , Vincent Guittot , Paolo Bonzini , Daniel Bristot de Oliveira , Jason Wang , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Zhen Lei , Juri Lelli Subject: Re: [PATCH 1/3] sched/headers: Fix compilation error with GCC 12 Message-Id: <20220414133050.b820fa45d42de4cfc24db82b@linux-foundation.org> In-Reply-To: References: <20220414150855.2407137-1-dinechin@redhat.com> <20220414150855.2407137-2-dinechin@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Apr 2022 17:21:01 +0200 Peter Zijlstra wrote: > > +/* The + 1 below places the pointers within the range of their array */ > > #define for_class_range(class, _from, _to) \ > > - for (class = (_from); class != (_to); class--) > > + for (class = (_from); class + 1 != (_to) + 1; class--) > > Urgh, so now we get less readable code, just because GCC is being > stupid? > > What's wrong with negative array indexes? memory is memory, stuff works. What's more, C is C. Glorified assembly language in which people do odd stuff. But this is presumably a released gcc version and we need to do something. And presumably, we need to do a backportable something, so people can compile older kernels with gcc-12. Is it possible to suppress just this warning with a gcc option? And if so, are we confident that this warning will never be useful in other places in the kernel? If no||no then we'll need to add workarounds such as these?