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.

Patch provided by Mamoru Tasaka, Fedora
This commit is contained in:
Holger Vogt 2023-02-01 13:10:53 +01:00
parent 0ce2e2467a
commit 26cf1a7a57
1 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,9 @@
#include <stddef.h>
#include <stdint.h>
#ifndef _MSC_VER
#include <stdalign.h>
#endif
#ifdef _MSC_VER
typedef struct {
@ -44,7 +47,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