```
clang++ --version
Debian clang version 16.0.6 (19)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
```
/build.sh --debug --static
Searching for Clang...
Clang++ found at /usr/bin/clang++
Build path: /home/ChakraCore/out/Debug
Compile Target : System Default
Generating Debug build
...
[  0%] Building CXX object pal/src/CMakeFiles/Chakra.Pal.dir/cruntime/file.cpp.o
In file included from /home/ChakraCore/pal/src/cruntime/file.cpp:23:
In file included from /home/ChakraCore/pal/src/include/pal/palinternal.h:323:
/home/ChakraCore/pal/inc/pal.h:2682:31: error: size of array element of type 'PM128A' (aka '_M128U *') (8 bytes) isn't a multiple of its alignment (16 bytes)
        PM128A FloatingContext[16];
                              ^
1 error generated.
pal/src/CMakeFiles/Chakra.Pal.dir/build.make:75: recipe for target 'pal/src/CMakeFiles/Chakra.Pal.dir/cruntime/file.cpp.o' failed
make[2]: *** [pal/src/CMakeFiles/Chakra.Pal.dir/cruntime/file.cpp.o] Error 1
CMakeFiles/Makefile2:643: recipe for target 'pal/src/CMakeFiles/Chakra.Pal.dir/all' failed
make[1]: *** [pal/src/CMakeFiles/Chakra.Pal.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
See error details above. Exit code was 2
```

As far as I understand, `PM128A` is a 16-byte aligned pointer (of size 8).

A single pointer can be aligned on 16-byte boundary, but the next pointer in the array will necessarily be 8-byte aligned.

This patch fixes the problem:
```
diff --git a/pal/inc/pal.h b/pal/inc/pal.h
index a68a6e65a..20ca7a80d 100644
--- a/pal/inc/pal.h
+++ b/pal/inc/pal.h
@@ -2498,7 +2498,8 @@ typedef struct _M128U {
 } M128U, *PM128U;

 // Same as _M128U but aligned to a 16-byte boundary
-typedef DECLSPEC_ALIGN(16) M128U M128A, *PM128A;
+typedef DECLSPEC_ALIGN(16) M128U M128A;
+typedef M128A *PM128A;

 typedef struct _XMM_SAVE_AREA32 {
     WORD   ControlWord;
```
Build failure with Clang 16.0.6 and 17 -- size of array element of type 'PM128A' (aka '_M128U *') (8 bytes) isn't a multiple of its alignment (16 bytes)
This is a GitHub Issue
repo:ChakraCore
owner:chakra-core
Title : Build failure with Clang 16.0.6 and 17 -- size of array element of type 'PM128A' (aka '_M128U *') (8 bytes) isn't a multiple of its alignment (16 bytes)
Issue date:

--- start body ---
```
clang++ --version
Debian clang version 16.0.6 (19)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
```
/build.sh --debug --static
Searching for Clang...
Clang++ found at /usr/bin/clang++
Build path: /home/ChakraCore/out/Debug
Compile Target : System Default
Generating Debug build
...
[  0%] Building CXX object pal/src/CMakeFiles/Chakra.Pal.dir/cruntime/file.cpp.o
In file included from /home/ChakraCore/pal/src/cruntime/file.cpp:23:
In file included from /home/ChakraCore/pal/src/include/pal/palinternal.h:323:
/home/ChakraCore/pal/inc/pal.h:2682:31: error: size of array element of type 'PM128A' (aka '_M128U *') (8 bytes) isn't a multiple of its alignment (16 bytes)
        PM128A FloatingContext[16];
                              ^
1 error generated.
pal/src/CMakeFiles/Chakra.Pal.dir/build.make:75: recipe for target 'pal/src/CMakeFiles/Chakra.Pal.dir/cruntime/file.cpp.o' failed
make[2]: *** [pal/src/CMakeFiles/Chakra.Pal.dir/cruntime/file.cpp.o] Error 1
CMakeFiles/Makefile2:643: recipe for target 'pal/src/CMakeFiles/Chakra.Pal.dir/all' failed
make[1]: *** [pal/src/CMakeFiles/Chakra.Pal.dir/all] Error 2
Makefile:90: recipe for target 'all' failed
make: *** [all] Error 2
See error details above. Exit code was 2
```

As far as I understand, `PM128A` is a 16-byte aligned pointer (of size 8).

A single pointer can be aligned on 16-byte boundary, but the next pointer in the array will necessarily be 8-byte aligned.

This patch fixes the problem:
```
diff --git a/pal/inc/pal.h b/pal/inc/pal.h
index a68a6e65a..20ca7a80d 100644
--- a/pal/inc/pal.h
+++ b/pal/inc/pal.h
@@ -2498,7 +2498,8 @@ typedef struct _M128U {
 } M128U, *PM128U;

 // Same as _M128U but aligned to a 16-byte boundary
-typedef DECLSPEC_ALIGN(16) M128U M128A, *PM128A;
+typedef DECLSPEC_ALIGN(16) M128U M128A;
+typedef M128A *PM128A;

 typedef struct _XMM_SAVE_AREA32 {
     WORD   ControlWord;
```
--- end body ---

The issue describes a build failure in ChakraCore due to a misalignment of the PM128A type, which is expected to be 16-byte aligned. The error occurs because the size of the array element (8 bytes) is not a multiple of its alignment (16 bytes). This can lead to potential undefined behavior or crashes when the code is executed. The proposed patch correctly defines PM128A as a pointer type, which resolves the alignment issue and allows for successful compilation.