Re: [PATCH] bitops: avoid clang shift-count-overflow warnings
From: Arnd Bergmann
Date: Tue May 05 2020 - 11:44:33 EST
On Tue, May 5, 2020 at 5:36 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
> On Tue, May 5, 2020 at 8:33 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >
> > I'm not sure if there is anything to be done about it in clang, since it
> > always does syntactic analysis before dead-code elimination by design.
>
> That's pretty much it. We had a patch to Clang to use delayed
> diagnostics to delay emitting the warning in case the AST node was
> dropped, but it wasn't accepted in code review.
>
> >
> > It is a bit odd though that it only prints the warning sometimes, but
>
> Sometimes?
Well, the file is included everywhere in the kernel, but we normally
don't get the
warning at all. However, I sometimes make incorrect changes to one file that
cause some other warning, and the result is an stream of warnings about
things like this one that are normally hidden. The shift count warning is the
one that shows up the most. I should try to come up with a better way to
reproduce it.
Arnd