Bug 96067 - __atomic_compare_exchange_n should return bool instead of void
Summary: __atomic_compare_exchange_n should return bool instead of void
Status: RESOLVED DUPLICATE of bug 96066
Alias: None
Product: gcc
Classification: Unclassified
Component: jit (show other bugs)
Version: 10.1.0
: P3 normal
Target Milestone: ---
Assignee: David Malcolm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-05 13:08 UTC by Antoni
Modified: 2021-12-11 22:20 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-07-06 00:00:00


Attachments
Reproducer for thebug (1.33 KB, text/x-csrc)
2020-07-06 12:13 UTC, Antoni
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antoni 2020-07-05 13:08:14 UTC
Hi.
The builtin __atomic_compare_exchange_n returns a void instead of bool.
Thanks to fix this issue.
Comment 1 Jonathan Wakely 2020-07-06 10:53:41 UTC
(In reply to Antoni from comment #0)
> The builtin __atomic_compare_exchange_n returns a void instead of bool.

This is not a very useful bug report.

Do you have a testcase? Is this something specific to libgccjit?
Comment 2 Antoni 2020-07-06 12:13:06 UTC
Created attachment 48835 [details]
Reproducer for thebug

Here's a reproducer for the bug.
The doc says it should return bool (https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html), but this reproducer shows the following error:

libgccjit.so: error: gcc_jit_block_end_with_return: mismatching types: return of __atomic_compare_exchange_n ((&var), (&var), (int)0, (bool)0, (int)0, (int)0) (type: void) in function hello (return type: bool)
Comment 3 Jonathan Wakely 2020-07-06 12:18:27 UTC
Thanks
Comment 4 Antoni 2021-05-18 01:06:22 UTC
Closing in favor of 96066.

That should be using a number instead of `n` as in `__atomic_compare_exchange_4`.

*** This bug has been marked as a duplicate of bug 96066 ***
Comment 5 GCC Commits 2021-12-11 22:20:32 UTC
The master branch has been updated by Antoni Boucher <antoyo@gcc.gnu.org>:

https://gcc.gnu.org/g:611fdb0fc5b95ee15215e2e3679834f311919096

commit r12-5912-g611fdb0fc5b95ee15215e2e3679834f311919096
Author: Antoni Boucher <bouanto@zoho.com>
Date:   Sat Dec 11 16:42:54 2021 -0500

    libgccjit: Add support for types used by atomic builtins [PR96066] [PR96067]
    
    2021-12-11  Antoni Boucher  <bouanto@zoho.com>
    
    gcc/jit/
            PR target/96066
            PR target/96067
            * jit-builtins.c: Implement missing types for builtins.
            * jit-recording.c:: Allow sending a volatile const void * as
            argument.
            * jit-recording.h: New functions (is_volatile, is_const) and
            allow comparing qualified types.
    
    gcc/testsuite/
            PR target/96066
            PR target/96067
            * jit.dg/all-non-failing-tests.h: Add test-builtin-types.c.
            * jit.dg/test-builtin-types.c
            * jit.dg/test-error-bad-assignment.c
            * jit.dg/test-fuzzer.c: Add fuzzing for type qualifiers.
    
    Signed-off-by: Antoni Boucher <bouanto@zoho.com>