ref: 53e3d2bb7e010971079152eb7b109161f47289e0
parent: 7ccaf862417a90af7a04750718c49a5731301fa4
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Jan 27 14:47:44 EST 2025
satisfy clang ubsan
--- a/flisp.c
+++ b/flisp.c
@@ -846,7 +846,7 @@
*(uint32_t*)(a) = (uint32_t)(i); \
}while(0)
#else
-#define GET_INT32(a) (int32_t)((a)[0]<<0 | (a)[1]<<8 | (a)[2]<<16 | (a)[3]<<24)
+#define GET_INT32(a) (int32_t)((a)[0]<<0 | (a)[1]<<8 | (a)[2]<<16 | (uint32_t)(a)[3]<<24)
#define GET_INT16(a) (int16_t)((a)[0]<<0 | (a)[1]<<8)
#define PUT_INT32(a, i) \
do{ \
--- a/posix/platform.h
+++ b/posix/platform.h
@@ -84,7 +84,8 @@
#endif
#endif
-#if defined(__386__) || defined(__x86_64__) || defined(__aarch64__)
+// FIXME: __clang__ because no idea how to check if ubsan is enabled.
+#if !defined(__clang__) && (defined(__386__) || defined(__x86_64__) || defined(__aarch64__))
#define MEM_UNALIGNED_ACCESS
#endif