Re: git: 3fe1f21fb364 - main - ctf: Avoid passing a caddr_t to roundup2()

From: Mark Johnston <markj_at_freebsd.org>
Date: Mon, 07 Mar 2022 19:09:02 UTC
On Mon, Mar 07, 2022 at 11:04:51AM -0800, John Baldwin wrote:
> On 3/7/22 8:21 AM, Mark Johnston wrote:
> > The branch main has been updated by markj:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=3fe1f21fb364e38f2bf7e7100dad59b067b27080
> > 
> > commit 3fe1f21fb364e38f2bf7e7100dad59b067b27080
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2022-03-07 16:18:40 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2022-03-07 16:20:57 +0000
> > 
> >      ctf: Avoid passing a caddr_t to roundup2()
> >      
> >      For some reason I can't reproduce this locally, but Jenkins complains.
> >      
> >      Reported by:    Jenkins
> >      Fixes:          bdf290cd3e1a ("ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}")
> 
> Odd, do you have a copy of the warning/error you got (and which compiler and arch?)

/usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c:1336:11: error: invalid operands to binary expression ('caddr_t' (aka 'char *') and 'int')
                        dptr = roundup2(dptr, 4);
                               ^~~~~~~~~~~~~~~~~
/usr/include/sys/param.h:310:38: note: expanded from macro 'roundup2'
#define roundup2(x, y)  (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
                         ~~~~~~~~~~~~~^~~~~~~~~~~

I'm not sure which compiler was in use.  All platforms failed.

I later tried building world in a 13.0-RELEASE amd64 jail, and that
reproduced the failure.  So maybe the version of LLVM shipped there
(11.0) is more picky?

> Even for CHERI (which can be pickier about such things) roundup2() works fine on
> caddr_t / char *.
> 
> -- 
> John Baldwin