Re: [PATCH] rdma/siw: Use proper enumerated type in map_cqe_status

From: Nick Desaulniers
Date: Tue Aug 27 2019 - 18:50:59 EST


On Tue, Aug 27, 2019 at 2:27 PM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> On Tue, Aug 27, 2019 at 12:23 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> >
> > On Tue, Aug 27, 2019 at 08:00:18PM +0300, Leon Romanovsky wrote:
> > > On Tue, Aug 27, 2019 at 10:08:30AM -0500, Josh Poimboeuf wrote:
> > > > On Mon, Aug 26, 2019 at 04:38:29PM -0700, Nathan Chancellor wrote:
> > > > > Looks like that comes from tune_qsfp, which gets inlined into
> > > > > tune_serdes but I am far from an objtool expert so I am not
> > > > > really sure what kind of issues I am looking for. Adding Josh
> > > > > and Peter for a little more visibility.
> > > > >
> > > > > Here is the original .o file as well:
> > > > >
> > > > > https://github.com/nathanchance/creduce-files/raw/4e252c0ca19742c90be1445e6c722a43ae561144/rdma-objtool/platform.o.orig
> > > >
> > > > 574: 0f 87 00 0c 00 00 ja 117a <tune_serdes+0xdfa>
> > > >
> > > > It's jumping to la-la-land past the end of the function.
> > >
> > > How is it possible?
> >
> > Looks like a compiler bug.
>
> Nathan,
> Thanks for the reduced test case. I modified it slightly:
> https://godbolt.org/z/15xejg
>
> You can see that the label LBB0_5 seemingly points off into space.
> Let me play with this one more a bit, then I will file a bug and
> report back.

Something funny going on in one of the earliest optimizations. Seems
related to an analysis that's deducing that the case statement is
exhaustive (so the GNU C case range is unrelated), but it's keeping
the default case and its comparison around. The analysis is correct;
the value should never be > 0xF so there shouldn't be any runtime
bugs, but this would avoid an unnecessary comparison for exhaustive
switch statements and save a few bytes of object code in such cases.

Filed: https://bugs.llvm.org/show_bug.cgi?id=43129
--
Thanks,
~Nick Desaulniers