maybe return something like (prev & 0xff) ?

On 27 June 2017 at 10:51, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolai...@nokia.com> wrote:

>
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of
> Brian
> > Brooks
> > Sent: Monday, June 26, 2017 9:21 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH] build: better atomics detection
> >
> > Do not optimize away the result of an atomic operation
> > during atomics detection in configure stage of build.
> >
> > This resolves ipfragreass build breakage with clang on
> > 32-bit systems.
> >
> > Signed-off-by: Brian Brooks <brian.bro...@arm.com>
> > ---
> >  platform/linux-generic/m4/configure.m4 | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-
> > generic/m4/configure.m4
> > index e1197f60..af645e05 100644
> > --- a/platform/linux-generic/m4/configure.m4
> > +++ b/platform/linux-generic/m4/configure.m4
> > @@ -34,10 +34,13 @@ use_libatomic=no
> >  AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
> >  AC_LINK_IFELSE(
> >    [AC_LANG_SOURCE([[
> > -    static int loc;
> > +    #include <stdint.h>
> > +    static uint64_t loc;
> >      int main(void)
> >      {
> > -        int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> > +        uint64_t prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
>
> Wouldn't volatile work. I'd avoid inline asm here if it can be avoided.
>
> volatile uint64_t prev = ...;
>
> -Petri
>
>
>

Reply via email to