Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1538744pxu; Sat, 12 Dec 2020 16:56:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJygxivCuJlONkBbE4TJBFqEy+FdnRMOj0xp3s3F2M4s7B3wW9xvHesUchpsKKTEKVRz+TQF X-Received: by 2002:a17:906:2f87:: with SMTP id w7mr3167174eji.83.1607820964797; Sat, 12 Dec 2020 16:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607820964; cv=none; d=google.com; s=arc-20160816; b=O+k+35eEjrz+glyNIw+CT8EhLjWNHCRSd440DOject4dZx02u5whpUWd/158Gq2X3l Svgq+PYrcKwl+QeeNDRUgB9auaiXienQhnMpneZudkGKzerQU0sObxq7RC+5ME1BQFy6 8WIi0BDbr6AIMlWr1hZQkYf5wHMCfhWJSAcKECXyYfeXD4wNocQIPuD+QTe6Iekn1dQS 9G802Ds0EukSWVFcGcTzButbFV+xkAp1QUVe+s4FS2HeiDYciBzYfGyLYRC0Flo86Ghz NkQ83yrYFznNtpcJ1+RYh05SnKzR73d8NWg4ocJhKXnrZts31T3tG2PU7PoCwTirdWgI lLTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zZ6u/dgwrNzUyp4/iz48nhaBhU4okUzFL8r3cjiaumE=; b=PosVWJ78eUp4lS1zUw5JpRIKFrbEUcw9B2HO4b4wnXYKJ941Z4ssDNqNqs4UTSO4Ad y5zBZFqoaXrS6k5wPhDG6CvIDIoG/QH3wJJNtzpesGhUtc5g4wPANu4WEFrXT9doG00B 4XBaMX0O9mn68wjAfjPOLR21p7ytaKLzt36lwxswwUkxwVIvssXeJKL3iSuUM4ce3UgI jjZhpr9eo23IxIa2QI9Tv8uq96jNbkawRrxT/NiW0mI1cwwg0gYTZ3ywgwBnMrCB621Z iwBYVfAVQlT6Clv2Rj1fzacos5QHjvawhzjLVYz7mQ+VolqqWWyG+5ULatbsedpNh9r0 SOUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XBAN1oa9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si8278358edv.324.2020.12.12.16.55.17; Sat, 12 Dec 2020 16:56:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XBAN1oa9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390054AbgLKTQ1 (ORCPT + 99 others); Fri, 11 Dec 2020 14:16:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389157AbgLKTQH (ORCPT ); Fri, 11 Dec 2020 14:16:07 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 692FDC0613D3 for ; Fri, 11 Dec 2020 11:15:27 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id iq13so2661244pjb.3 for ; Fri, 11 Dec 2020 11:15:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zZ6u/dgwrNzUyp4/iz48nhaBhU4okUzFL8r3cjiaumE=; b=XBAN1oa9ls86gvI7Rrnt5AyC5R+ixC3nwLXb55s22TP88HhK2MLDugo2jIX42wIqaj W58fWoEwyCmXY8A+s8wJH5GGrYkrba1Wmy2iLyw86qIkCYwxwgVDJgII9ekjxgyfb683 EtZHogzterQzh21PmL5ZhdmvU3Wr3A6O9vlwL2EUSOLEm7qhJayiPqnIKX8yyUf6PKi8 UPO+6ovJOsVfOah/BJF1bDoCkbKdOHvQM0aRi3a/Gt/T5X6HMg0N0yrO5C5b/mYA8eNY o5GCk/a4Vcz/VH3Lj6BC6//DmX4EiOizRtYHgvuPmyG4Z8zL9bQrBoNP9Kw6AHDKqdwB Qt0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zZ6u/dgwrNzUyp4/iz48nhaBhU4okUzFL8r3cjiaumE=; b=CN5Sxp7NF2Ah0Pqq0lAWJ3ylbYyzqgkjf6tpwn38I/2qJpMZiF6cDWCAppITlEZS+z 1a7WYZiI9ctu8lyAV30aydvHuzJac6yCLd/xFXVN+vI6OYBsI2CF+lmhGRzkhgB7cGJP mmkwATFm3JmGQZnrCDj/80NQ+3F3lLpUZ+Ct+z4pVo/9S85InrRi5SIViUQJGsydATZg N/3aFrtD+ngl2vP9yfN1x6dxsrchBvw/QYRhpFzIATswKIazGdgvmoSDRsfS0QRvnf5z 8jiX4cqeV4Or6KaJsj6h/dTBo8WstQH9mJmGL9oGX2YOAIMV1yHPfd7cwKmjqtg4QHCk VX3Q== X-Gm-Message-State: AOAM530MN2ckR+UaM3JaVT44dRu3mtG4NMLU+mSZSWltLUeovPv18LLT tn5te5CNRmQM6dh8jiYlXzTYYEHL3xn60fdODmVZfQ== X-Received: by 2002:a17:902:26a:b029:da:af47:77c7 with SMTP id 97-20020a170902026ab02900daaf4777c7mr12440421plc.10.1607714126633; Fri, 11 Dec 2020 11:15:26 -0800 (PST) MIME-Version: 1.0 References: <20201211102437.3929348-1-anders.roxell@linaro.org> In-Reply-To: <20201211102437.3929348-1-anders.roxell@linaro.org> From: Nick Desaulniers Date: Fri, 11 Dec 2020 11:15:15 -0800 Message-ID: Subject: Re: [PATCH v2] mips: lib: uncached: fix non-standard usage of variable 'sp' To: Anders Roxell Cc: Thomas Bogendoerfer , Nathan Chancellor , linux-mips@vger.kernel.org, LKML , clang-built-linux , Naresh Kamboju Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 2:24 AM Anders Roxell wrote: > > When building mips tinyconfig with clang the following warning show up: > > arch/mips/lib/uncached.c:45:6: warning: variable 'sp' is uninitialized when used here [-Wuninitialized] > if (sp >= (long)CKSEG0 && sp < (long)CKSEG2) > ^~ > arch/mips/lib/uncached.c:40:18: note: initialize the variable 'sp' to silence this warning > register long sp __asm__("$sp"); > ^ > = 0 > 1 warning generated. > > Rework to make an explicit inline move, instead of the non-standard use > of specifying registers for local variables. This is what's written > from the gcc-10 manual [1] about specifying registers for local > variables: > > "6.47.5.2 Specifying Registers for Local Variables > ................................................. > [...] > > "The only supported use for this feature is to specify registers for > input and output operands when calling Extended 'asm' (*note Extended > Asm::). [...]". > > [1] https://docs.w3cub.com/gcc~10/local-register-variables > Signed-off-by: Anders Roxell Link: https://github.com/ClangBuiltLinux/linux/issues/606 Reported-by: Nathan Chancellor Reported-by: Naresh Kamboju Reviewed-by: Nick Desaulniers > --- > arch/mips/lib/uncached.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c > index 09d5deea747f..f80a67c092b6 100644 > --- a/arch/mips/lib/uncached.c > +++ b/arch/mips/lib/uncached.c > @@ -37,10 +37,12 @@ > */ > unsigned long run_uncached(void *func) > { > - register long sp __asm__("$sp"); > register long ret __asm__("$2"); > long lfunc = (long)func, ufunc; > long usp; > + long sp; > + > + __asm__("move %0, $sp" : "=r" (sp)); > > if (sp >= (long)CKSEG0 && sp < (long)CKSEG2) > usp = CKSEG1ADDR(sp); > -- > 2.29.2 > -- Thanks, ~Nick Desaulniers