Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jul 2020 01:16:43 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Cc:        freebsd-ppc <freebsd-ppc@freebsd.org>
Subject:   powerpc64: error: 'tmp' is used uninitialized in 'atomic_cmpset_masked' stops buildkernel via gcc9
Message-ID:  <D321893E-4D35-4BAA-8FCC-FC247219FC18@yahoo.com>
References:  <D321893E-4D35-4BAA-8FCC-FC247219FC18.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The following is more informational than anything as far
as I'm concerned. But there may be implications that I'm
unaware of. (I sometimes experiment with toolchain use
to see what the current status is for such use.)

In attempting to buildworld buildkernel via
powerpc64-unknown-freebsd13.0-gcc9 (via amd64->powerpc64
cross build):

--- vfs_vnops.o ---
In file included from /usr/src/sys/sys/systm.h:44,
                 from /usr/src/sys/kern/vfs_vnops.c:51:
/usr/src/sys/kern/vfs_vnops.c: In function 'atomic_cmpset_masked':
./machine/atomic.h:623:2: error: 'tmp' is used uninitialized in this =
function [-Werror=3Duninitialized]
  623 |  __asm __volatile (
      |  ^~~~~

This was for:

#else
static __inline int
atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uint32_t newval,
    uint32_t mask)
{
        int             ret;
        uint32_t        tmp;

        __asm __volatile (
                "1:\tlwarx %2, 0, %3\n\t"       /* load old value */
                "and %0, %2, %7\n\t"
                "cmplw %4, %0\n\t"              /* compare */
                "bne- 2f\n\t"                   /* exit if not equal */
                "andc %2, %2, %7\n\t"
                "or %2, %2, %5\n\t"
                "stwcx. %2, 0, %3\n\t"          /* attempt to store */
                "bne- 1b\n\t"                   /* spin if failed */
                "li %0, 1\n\t"                  /* success - retval =3D =
1 */
                "b 3f\n\t"                      /* we've succeeded */
                "2:\n\t"
                "stwcx. %2, 0, %3\n\t"          /* clear reservation =
(74xx) */
                "li %0, 0\n\t"                  /* failure - retval =3D =
0 */
                "3:\n\t"
                : "=3D&r" (ret), "=3Dm" (*p), "+&r" (tmp)
                : "r" (p), "r" (cmpval), "r" (newval), "m" (*p),
                  "r" (mask)
                : "cr0", "memory");

        return (ret);
}

(Looks like the lwarx initializes tmp to me.)

This was an attempt to cross-build head -r363000 ( via
-r363000 ).

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D321893E-4D35-4BAA-8FCC-FC247219FC18>