add_-latomic_to_ghc-prim
authorDebian Haskell Group <pkg-haskell-maintainers@lists.alioth.debian.org>
Tue, 24 Mar 2020 01:50:31 +0000 (01:50 +0000)
committerSandro Tosi <morph@debian.org>
Tue, 24 Mar 2020 01:50:31 +0000 (01:50 +0000)
commit ce3897ffd6e7c8b8f36b8e920168bac8c7f836ae
Author: Ilias Tsitsimpis <iliastsi@debian.org>
Date:   Tue Sep 18 17:45:17 2018 +0200

    Fix check whether GCC supports __atomic_ builtins

    Summary:
    C11 atomics are never used because:

    * The program used for checking whether GCC supports
    __atomic_ builtins fails with the following error:

    ```
      error: size mismatch in argument 2 of `__atomic_load`
       int test(int *x) { int y; __atomic_load(&x, &y, __ATOMIC_SEQ_CST); return x; }
    ```

    * There is a typo when checking if CONF_GCC_SUPPORTS__ATOMICS equals YES,
    resulting in PRIM_CFLAGS and PRIM_EXTRA_LIBRARIES never being set.

    Reviewers: bgamari

    Reviewed By: bgamari

    Subscribers: rwbarton, erikd, carter

    Differential Revision: https://phabricator.haskell.org/D5154

Gbp-Pq: Name add_-latomic_to_ghc-prim

libraries/ghc-prim/aclocal.m4
libraries/ghc-prim/configure.ac

index e5695385f2638b9dc067b269aee9997f1d6a4d7b..81fc44c5008ec8c91179b4f8f44597c9083be82a 100644 (file)
@@ -5,7 +5,7 @@ AC_DEFUN([FP_GCC_SUPPORTS__ATOMICS],
 [
    AC_REQUIRE([AC_PROG_CC])
    AC_MSG_CHECKING([whether GCC supports __atomic_ builtins])
-   echo 'int test(int *x) { int y; __atomic_load(&x, &y, __ATOMIC_SEQ_CST); return x; }' > conftest.c
+   echo 'int test(int *x) { int y; __atomic_load(x, &y, __ATOMIC_SEQ_CST); return y; }' > conftest.c
    if $CC -c conftest.c > /dev/null 2>&1; then
        CONF_GCC_SUPPORTS__ATOMICS=YES
        AC_MSG_RESULT([yes])
index bacc89ccc818b59915719e1985f7c3ef9aec4059..8249be31a980307d3453bcada92ec594b11a006c 100644 (file)
@@ -8,7 +8,7 @@ dnl    unregisterised, Sparc, and PPC backends.
 FP_GCC_SUPPORTS__ATOMICS
 AC_DEFINE([HAVE_C11_ATOMICS], [$CONF_GCC_SUPPORTS__ATOMICS], [Does GCC support __atomic primitives?])
 
-if test "x$CONF_GCC_SUPPORTS__ATOMICS" = YES
+if test "$CONF_GCC_SUPPORTS__ATOMICS" = "YES"
 then PRIM_CFLAGS=-DHAVE_C11_ATOMICS
      PRIM_EXTRA_LIBRARIES=atomic
 fi