Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jul 2016 00:53:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 211304] 11.0 -r303168 buildkernel via devel/amd64-gcc fails for: dev/cxgbe/common/t4_hw.c warning: overflow in implicit constant conversion; more
Message-ID:  <bug-211304-8-ocCVhQkllT@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-211304-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-211304-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D211304

--- Comment #3 from Mark Millard <markmi@dsl-only.net> ---
(In reply to Mark Millard from comment #0)

The code in question for the overflow in an implicit constant conversion is
for:

        c.err_to_clearinit =3D cpu_to_be32(
                V_FW_HELLO_CMD_MASTERDIS(master =3D=3D MASTER_CANT) |
                V_FW_HELLO_CMD_MASTERFORCE(master =3D=3D MASTER_MUST) |
                V_FW_HELLO_CMD_MBMASTER(master =3D=3D MASTER_MUST ?
                                        mbox : M_FW_HELLO_CMD_MBMASTER) |
                V_FW_HELLO_CMD_MBASYNCNOT(evt_mbox) |
                V_FW_HELLO_CMD_STAGE(FW_HELLO_CMD_STAGE_OS) |
                F_FW_HELLO_CMD_CLEARINIT);

V_FW_HELLO_CMD_MASTERDIS uses S_FW_HELLO_CMD_MASTERDIS:

# grep V_FW_HELLO_CMD_MASTERDIS
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/*/*
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/common/t4_hw.c:=20=
=20=20=20=20=20=20=20=20
V_FW_HELLO_CMD_MASTERDIS(master =3D=3D MASTER_CANT) |
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/firmware/t4fw_interf=
ace.h:#define
V_FW_HELLO_CMD_MASTERDIS(x)    ((x) << S_FW_HELLO_CMD_MASTERDIS)
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/firmware/t4fw_interf=
ace.h:#define
F_FW_HELLO_CMD_MASTERDIS       V_FW_HELLO_CMD_MASTERDIS(1U)

S_FW_HELLO_CMD_MASTERDIS is 29:

# grep S_FW_HELLO_CMD_MASTERDIS
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/*/*
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/firmware/t4fw_interf=
ace.h:#define
S_FW_HELLO_CMD_MASTERDIS       29
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/firmware/t4fw_interf=
ace.h:#define
V_FW_HELLO_CMD_MASTERDIS(x)    ((x) << S_FW_HELLO_CMD_MASTERDIS)
/usr/src/sys/modules/cxgbe/if_cxgbe/../../../dev/cxgbe/firmware/t4fw_interf=
ace.h:
   (((x) >> S_FW_HELLO_CMD_MASTERDIS) & M_FW_HELLO_CMD_MASTERDIS)

S_FW_HELLO_CMD_MASTERDIS being 29 means that V_FW_HELLO_CMD_MASTERDIS(x)'s

((x) << S_FW_HELLO_CMD_MASTERDIS)

is far more than 16 bits wide. (I'll not list the other example bits.)

For:

./x86/endian.h:75:53: note: in definition of macro '__bswap16'
      __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
                                                     ^

the __bswap16_var is (from x86/endian.h ):

static __inline __uint16_t
__bswap16_var(__uint16_t _x)
{

        return (__bswap16_gen(_x));
}

and so there is an implicit truncation to 16 bits before __bswap16_gen(_x) =
and
its & 0xffff masking is involved. And that is what the compiler is complain=
ing
about: the implicit status of the truncation.

The truncated value appears to be fine for the code's purpose.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-211304-8-ocCVhQkllT>