qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 00/40] ppc patch queue 2015-06-03


From: Michael Roth
Subject: Re: [Qemu-devel] [PULL 00/40] ppc patch queue 2015-06-03
Date: Tue, 21 Jul 2015 18:32:47 -0500
User-agent: alot/0.3.6

Quoting Peter Maydell (2015-07-21 06:42:41)
> On 5 June 2015 at 16:20, Paolo Bonzini <address@hidden> wrote:
> > On 05/06/2015 17:08, Peter Maydell wrote:
> >>> > Can someone add a checkpatch rule that forbids shifting left U or UL
> >>> > constants (i.e. only ULL)?  That would alleviate my concerns with these
> >>> > ubsan warnings.
> >>
> >> ...but things like "(1U << 31)" are entirely valid.
> >
> > They're only valid until someone does a ~ on them.  I think it's
> > reasonable to forbid them in our coding standards, if we want to fix
> > ubsan's warning of (1 << 31).
> >
> > I don't think it's reasonable for compiler writers to exploit the
> > undefinedness of (1 << 31) anyway, and if it were possible to shut up
> > ubsan about this particular kind of undefined behavior, I would prefer it.
> 
> I just checked, and it isn't possible to suppress this particular
> shift warning without also turning off others that we would want
> to retain.
> 
> The ppc code is still provoking this sanitizer warning in my
> test runs :-(

Was I being silly by not just doing this is the first place?

-#define DRC_INDEX_ID_MASK (~(~0 << DRC_INDEX_TYPE_SHIFT))
+#define DRC_INDEX_ID_MASK ((1 << DRC_INDEX_TYPE_SHIFT) - 1)

Will send a proper patch to list in a moment.

> 
> thanks
> -- PMM
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]