From: Nathan Chancellor <nathan@kernel.org>
To: Kjetil Oftedal <oftedal@gmail.com>
Cc: Rosen Penev <rosenp@gmail.com>,
sparclinux@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
open list <linux-kernel@vger.kernel.org>,
"open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b"
<llvm@lists.linux.dev>
Subject: Re: [PATCH] sparc64: Define p4d_page() instead of stubbing it to NULL
Date: Tue, 6 Oct 2026 10:31:03 +0200 [thread overview]
Message-ID: <20261006083103.GA3041473@ax162> (raw)
In-Reply-To: <CALMQjD-udSokCKS07VFWauBQzac5BTPJqbORhskxgddsuX1vLw@mail.gmail.com>
On Tue, Oct 06, 2026 at 09:59:19AM +0200, Kjetil Oftedal wrote:
> On Mon, 5 Oct 2026 at 22:41, Rosen Penev <rosenp@gmail.com> wrote:
> >
> > A sparc64 allmodconfig build with LLVM fails in vmalloc_to_page():
> >
> > mm/vmalloc.c: error: performing pointer arithmetic on a null pointer
> > has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
> >
> > sparc64 defines p4d_page() as NULL, on the assumption that it is only
> > used by stubbed out hugetlb gup code. Generic code now uses it in
> > vmalloc_to_page(), ptdump and KASAN. In vmalloc_to_page() the NULL is
> > used in pointer arithmetic, which clang diagnoses even though the
> > branch is unreachable on sparc64.
> >
>
> Has this been reported as a bug to the clang project?
> As it throwing an error on a rather obviously unreachable branch.
Technically the error part is self-inflicted on the part of the kernel
since allmodconfig enables CONFIG_WERROR. That said, while it might be
nice for the compiler not to warn in any case of dead code, that's just
not how it works for either GCC or clang (none of these should be
visible if that were the case):
https://godbolt.org/z/K3nfW4n5f
--
Cheers,
Nathan
prev parent reply other threads:[~2026-10-06 8:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 20:39 Rosen Penev
2026-10-06 7:59 ` Kjetil Oftedal
2026-10-06 8:31 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261006083103.GA3041473@ax162 \
--to=nathan@kernel.org \
--cc=andreas@gaisler.com \
--cc=davem@davemloft.net \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=ndesaulniers@google.com \
--cc=oftedal@gmail.com \
--cc=rosenp@gmail.com \
--cc=sparclinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®