Blob Blame History Raw
From 24abf9df6f2f817823fa4fd8bffd21d2a1a38b8a Mon Sep 17 00:00:00 2001
From: ngspice maintainer <ngspice-owner@fedoraproject.org>
Date: Tue, 3 Jan 2023 18:36:44 +0900
Subject: [PATCH] osdi: fix wrong usage of max_align_t

max_align_t is used to examine the largest alignment requirement,
and it is expected to check the alignment value via alignof, not sizeof.

Otherwise, __attribute__((aligned)) can complain as required alignment
being invalid, e.g. on s390x.
---
 src/osdi/osdidefs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/osdi/osdidefs.h b/src/osdi/osdidefs.h
index 45d117336..3deabbd22 100644
--- a/src/osdi/osdidefs.h
+++ b/src/osdi/osdidefs.h
@@ -25,6 +25,7 @@
 
 #include <stddef.h>
 #include <stdint.h>
+#include <stdalign.h>
 
 #ifdef _MSC_VER
 typedef struct {
@@ -44,7 +45,7 @@ typedef struct {
 #ifdef _MSC_VER
 #define MAX_ALIGN 8
 #else
-#define MAX_ALIGN sizeof(max_align_t)
+#define MAX_ALIGN alignof(max_align_t)
 #endif
 
 
-- 
2.39.0