fix compilation failure on OpenBSD with system supplied GNU C 4.2.1
authorKarel Gardas <karel.gardas@centrum.cz>
Sat, 13 Aug 2016 16:46:43 +0000 (18:46 +0200)
committerKarel Gardas <karel.gardas@centrum.cz>
Sun, 14 Aug 2016 19:57:38 +0000 (21:57 +0200)
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

rts/sm/CNF.c

index 4689b46..0594a6e 100644 (file)
@@ -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;