From c74cdea9e6804d10660035700136975cfd39da8d Mon Sep 17 00:00:00 2001
From: Peter Trommler <ptrommler@acm.org>
Date: Fri, 31 Dec 2021 18:20:45 +0100
Subject: [PATCH] Disable unboxed arrays on big-endian

Unboxed arrays are broken on big-endian architectures, see
https://gitlab.haskell.org/ghc/ghc/-/issues/16998 for details.
This patch makes the use of unboxed arrays conditional on
little-endian architecture.

Fixes #673

diff --git a/libraries/containers/containers/include/containers.h b/libraries/containers/containers/include/containers.h
index cd201ca..fc2a0e8 100644
--- a/libraries/containers/containers/include/containers.h
+++ b/libraries/containers/containers/include/containers.h
@@ -35,7 +35,13 @@
 
 #ifdef __GLASGOW_HASKELL__
 # define USE_ST_MONAD 1
+#ifndef WORDS_BIGENDIAN
+/*
+ * Unboxed arrays are broken on big-endian architectures.
+ * See https://gitlab.haskell.org/ghc/ghc/-/issues/16998
+ */
 # define USE_UNBOXED_ARRAYS 1
 #endif
+#endif
 
 #endif
-- 
2.31.1

