On Mon, 20 Sep 2010 16:55:57 +1000 (EST) Bruce Evans <b...@optusnet.com.au> 
wrote:
> On Mon, 20 Sep 2010, Marcel Moolenaar wrote:
> 
> > Log:
> >  Unbreak the build on strong-aligned architectures (arm, ia64).
> >  Casting from (char *) to (struct ufs1_dinode *) changes the
> >  alignment requirement of the pointer and GCC does not know that
> >  the pointer is adequately aligned (due to malloc(3)), and warns
> >  about it. Cast to (void *) first to by-pass the check.
> 
> A previous version in which the pointer (iobuf) the correct type to
> begin with was better.  It used to have type void *, but now has type
> caddr_t (whose existence is a bug), in order to abuse caddr_t by
> assuming that it is char * to do pointer arithmetic on it in 1 place
> (iobuf + sblock.fs_cgsize).  The 7 other places where iobuf is used
> only assume that caddr_t is a pointer (or perhaps a [u]intptr_t).
> 
> growfs has no other instances of caddr_t.

Maybe iobuf ought to go back to being a void * with casting where the
arithmetic happens.  If it's changed, newfs/mkfs.c should probably change
too.

Is there some subtle difference that makes the casting ok in newfs/mkfs.c:

    dp1 = (struct ufs1_dinode *)(&iobuf[start]);

and not ok in growfs/growfs.c r212885:

    dp1 = (struct ufs1_dinode *)iobuf;

or is it just ignored because WARNS is 3 for newfs and is defaulted to 6 for 
growfs?

-- 
Brian Somers                                          <br...@awfulhak.org>
Don't _EVER_ lose your sense of humour !               <br...@freebsd.org>
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to