NetBSD-Bugs archive

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

Re: port-sh3/60773: sh3 __sync_val_compare_and_swap_1 test failures



The following reply was made to PR port-sh3/60773; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-sh3/60773: sh3 __sync_val_compare_and_swap_1 test failures
Date: Thu, 24 Sep 2026 03:18:03 +0300

 On Wed, Sep 23, 2026 at 13:45:00 +0000, martin%NetBSD.org@localhost via gnats wrote:
 
 > failed: /work/src/tests/lib/libc/atomic/t___sync_compare_and_swap.c:189: successful case: res expects 0x88 but 0xffffff88
 
 common/lib/libc/atomic/atomic_cas_8_cas.c defines
 sync_val_compare_and_swap_1 to return signed int8_t
 
 _atomic_cas_8 returns correct uin8_t value 0x88, then
 sync_val_compare_and_swap_1 sign extends it before returning.
 
 
 The change was in common/lib/libc/atomic/atomic_init_testset.c
 
   revision 1.22
   date: 2026-05-03 14:48:02 +0300;  author: skrll;  state: Exp;  lines: +40 -5;  commitid: z77RclIjL3bYwmEG;
   PR/56839 GCC emits wrong codes for compare_and_swap_1 bultins on armv5 (el & eb)
 
   There is mismatch in signedness of the GCC builtin __sync_* function arguments
   and the _atomic_* functions so we cannot directly alias them. Instead write
   the __sync_* functions with signed arguments and pass them the unsigned
   _atomics_* functions.
 
 So the testcase and the function declaration do not match.
 
 PS: Please, can someone write a manual page for these?  It's scores of
 function names that all look alike with a sprinkle of scrabble bag
 spillover randomly glued in unexpected places.
 
 gcc info only talks about "__sync_val_compare_and_swap" and refers to
 Intel's Itanium psABI, which is probably printed on fine leafs of
 unobtanium (if you are lucky - with a microfiche copy on archive.org
 w/out an OCR layer).  Anyway, finding this information shouldn't be a
 wild goose chase or an exercise in RTFS and repo archeology.
 
 -uwe
 



Home | Main Index | Thread Index | Old Index