NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-arm32/50513: Incorrect logic for atomic_nand_xx.S



>Number:         50513
>Category:       port-arm32
>Synopsis:       Incorrect logic for atomic_nand_xx.S
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-arm32-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 10 21:35:00 +0000 2015
>Originator:     Frank Zerangue
>Release:        NetBSD-7.0
>Organization:
>Environment:
Darwin Franks-Mac-Pro-3.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

>Description:
usr/src/common/lib/libc/arch/arm/atomic/atomic_nand_xx.S

http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html - defines 
type __sync_fetch_and_nand (type *ptr, type value, ...) as
  { tmp = *ptr; *ptr = ~tmp & value; return tmp; }   // NAND

atomic_nand_xx.S implements the logic defined above (4.1.2) which is not a correct NAND function but should be implemented as defined below (4.4.5) which is a correct NAND function.

https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/Atomic-Builtins.html - defines
type __sync_fetch_and_nand (type *ptr, type value, ...) as
  { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }   // NAND
>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index