Re: A suspicious warning in sys/boot/zfs/zfsimpl.c

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Sat, 1 Dec 2012 16:37:39 -0800
On Sat, Dec 1, 2012 at 3:05 AM, Andriy Gapon <avg_at_freebsd.org> wrote:

> I believe that there is no actual problem there.

    It's probably bugs with clang dealing with alignment problems.
These warnings (and others) go largely unnoticed because of the fact
that -Werror isn't on on sys/boot. I filed kern/173932 for that and
have been grinding away on warnings for the past couple days in my
spare time -- with my local modifications sys/boot compiles with
-Werror now with gcc, but not clang.
Thanks,
-Garrett

/store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:101:24: error:
tentative definition of variable with internal linkage has incomplete
non-array type 'struct zfsmount'
[-Werror,-Wtentative-definition-incomplete-type]
static struct zfsmount zfsmount;
                       ^
/store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:101:15: note:
forward declaration of 'struct zfsmount'
static struct zfsmount zfsmount;
              ^
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
In file included from
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:38:
/store/freebsd/head/sys/boot/i386/zfsboot/../../../cddl/boot/zfs/zfssubr.c:207:9:
error: cast from 'char *' to 'zio_eck_t *' (aka 'struct zio_eck *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
                eck = (zio_eck_t *)((char *)data + size) - 1;
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
===> lib/libpam/modules/pam_rhosts (all)
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
===> usr.sbin/devinfo (all)
`kldstat.o' is up to date.
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:876:28:
error: cast from 'char *' to 'vdev_phys_t *' (aka 'struct vdev_phys
*') increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        vdev_phys_t *vdev_label = (vdev_phys_t *) zap_scratch;
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1043:7:
error: cast from 'char *' to 'const struct uberblock *' increases
required alignment from 1 to 4 [-Werror,-Wcast-align]
        up = (const struct uberblock *)upbuf;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1223:12:
error: cast from 'char *' to 'const blkptr_t *' (aka 'const struct
blkptr *') increases required alignment from 1 to 4
[-Werror,-Wcast-align]
                        indbp = (const blkptr_t *) dnode_cache_buf;
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1262:7:
error: cast from 'char *' to 'const mzap_phys_t *' (aka 'const struct
mzap_phys *') increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        mz = (const mzap_phys_t *) zap_scratch;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1289:8:
error: cast from 'uint16_t *' (aka 'unsigned short *') to
'zap_leaf_chunk_t *' (aka 'union zap_leaf_chunk *') increases required
alignment from 2 to 4 [-Werror,-Wcast-align]
        nc = &ZAP_LEAF_CHUNK(zl, zc->l_entry.le_name_chunk);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../../cddl/boot/zfs/zfsimpl.h:1139:3:
note: expanded from macro 'ZAP_LEAF_CHUNK'
        ((zap_leaf_chunk_t *) \
         ^~~~~~~~~~~~~~~~~~~~~~
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1300:9:
error: cast from 'uint16_t *' (aka 'unsigned short *') to
'zap_leaf_chunk_t *' (aka 'union zap_leaf_chunk *') increases required
alignment from 2 to 4 [-Werror,-Wcast-align]
                nc = &ZAP_LEAF_CHUNK(zl, nc->l_array.la_next);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../../cddl/boot/zfs/zfsimpl.h:1139:3:
note: expanded from macro 'ZAP_LEAF_CHUNK'
        ((zap_leaf_chunk_t *) \
         ^~~~~~~~~~~~~~~~~~~~~~
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1317:8:
error: cast from 'uint16_t *' (aka 'unsigned short *') to
'zap_leaf_chunk_t *' (aka 'union zap_leaf_chunk *') increases required
alignment from 2 to 4 [-Werror,-Wcast-align]
        vc = &ZAP_LEAF_CHUNK(zl, zc->l_entry.le_value_chunk);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../../cddl/boot/zfs/zfsimpl.h:1139:3:
note: expanded from macro 'ZAP_LEAF_CHUNK'
        ((zap_leaf_chunk_t *) \
         ^~~~~~~~~~~~~~~~~~~~~~
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1333:19:
error: cast from 'char *' to 'zap_phys_t *' (aka 'struct zap_phys *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        zap_phys_t zh = *(zap_phys_t *) zap_scratch;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1343:15:
error: cast from 'char *' to 'zap_phys_t *' (aka 'struct zap_phys *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        z.zap_phys = (zap_phys_t *) zap_scratch;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1353:12:
error: cast from 'char *' to 'uint64_t *' (aka 'unsigned long long *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
                ptrtbl = (uint64_t *) zap_scratch;
                         ^~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1370:14:
error: cast from 'char *' to 'zap_leaf_phys_t *' (aka 'struct
zap_leaf_phys *') increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        zl.l_phys = (zap_leaf_phys_t *) zap_scratch;
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1388:8:
error: cast from 'uint16_t *' (aka 'unsigned short *') to
'zap_leaf_chunk_t *' (aka 'union zap_leaf_chunk *') increases required
alignment from 2 to 4 [-Werror,-Wcast-align]
        zc = &ZAP_LEAF_CHUNK(&zl, h);
              ^~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../../cddl/boot/zfs/zfsimpl.h:1139:3:
note: expanded from macro 'ZAP_LEAF_CHUNK'
        ((zap_leaf_chunk_t *) \
         ^~~~~~~~~~~~~~~~~~~~~~
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1394:9:
error: cast from 'uint16_t *' (aka 'unsigned short *') to
'zap_leaf_chunk_t *' (aka 'union zap_leaf_chunk *') increases required
alignment from 2 to 4 [-Werror,-Wcast-align]
                zc = &ZAP_LEAF_CHUNK(&zl, zc->l_entry.le_next);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../../cddl/boot/zfs/zfsimpl.h:1139:3:
note: expanded from macro 'ZAP_LEAF_CHUNK'
        ((zap_leaf_chunk_t *) \
         ^~~~~~~~~~~~~~~~~~~~~~
In file included from /store/freebsd/head/sys/boot/i386/zfsboot/zfsboot.c:151:
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1420:14:
error: cast from 'char *' to 'uint64_t *' (aka 'unsigned long long *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        zap_type = *(uint64_t *) zap_scratch;
                    ^~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1446:7:
error: cast from 'char *' to 'const mzap_phys_t *' (aka 'const struct
mzap_phys *') increases required alignment from 1 to 4
[-Werror,-Wcast-align]
        mz = (const mzap_phys_t *) zap_scratch;
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1467:19:
error: cast from 'char *' to 'zap_phys_t *' (aka 'struct zap_phys *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        zap_phys_t zh = *(zap_phys_t *) zap_scratch;
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
/store/freebsd/head/sys/boot/i386/zfsboot/../../zfs/zfsimpl.c:1475:15:
error: cast from 'char *' to 'zap_phys_t *' (aka 'struct zap_phys *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        z.zap_phys = (zap_phys_t *) zap_scratch;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
===> gnu/usr.bin/groff/src/roff (all)
(cd /store/freebsd/head/rescue/rescue/../../sbin/kldunload &&  make
-DRESCUE CRUNCH_CFLAGS=-DRESCUE DIRPRFX=rescue/rescue/kldunload/
depend && make -DRESCUE CRUNCH_CFLAGS=-DRESCUE
DIRPRFX=rescue/rescue/kldunload/ kldunload.o)
20 errors generated.
*** [zfsboot.o] Error code 1
1 error
*** [all] Error code 2
1 error
*** [all] Error code 2
1 error
*** [all] Error code 2
1 error
*** [sys.all__D] Error code 2
Received on Sat Dec 01 2012 - 23:37:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:32 UTC