[commit: ghc] master: fix compilation failure on OpenBSD with system supplied GNU C 4.2.1 (ffd4029)

git at git.haskell.org git at git.haskell.org
Sun Aug 14 19:57:51 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ffd4029c5bc581ac749f5cdc3d8e085c80add585/ghc

>---------------------------------------------------------------

commit ffd4029c5bc581ac749f5cdc3d8e085c80add585
Author: Karel Gardas <karel.gardas at centrum.cz>
Date:   Sat Aug 13 18:46:43 2016 +0200

    fix compilation failure on OpenBSD with system supplied GNU C 4.2.1
    
    Summary:
    This patch fixes compilation failure on OpenBSD. The OpenBSD's
    GNU C compiler is of 4.2.1 version and problematic __builtin_unreachable
    was added in GNU C 4.5 release. Let's use pure abort() call
    on OpenBSD instead of __builtin_unreachable
    
    Reviewers: bgamari, austin, erikd, simonmar
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2453


>---------------------------------------------------------------

ffd4029c5bc581ac749f5cdc3d8e085c80add585
 rts/sm/CNF.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c
index 4689b46..0594a6e 100644
--- a/rts/sm/CNF.c
+++ b/rts/sm/CNF.c
@@ -164,8 +164,11 @@ compactAllocateBlockInternal(Capability            *cap,
     default:
 #ifdef DEBUG
         ASSERT(!"code should not be reached");
-#else
+#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+        /* __builtin_unreachable is supported since GNU C 4.5 */
         __builtin_unreachable();
+#else
+        abort();
 #endif
     }
     RELEASE_SM_LOCK;



More information about the ghc-commits mailing list