You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
#6982
/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;
The text was updated successfully, but these errors were encountered:
After thinking for a bit it does look right. I guess time to start building with dev clang to get advance notice on issues like this. Another aside is I am personally uncomfortable with PAL because of the code like this - it does win32 things which Windows does internally in user mode and it has been a source of problems.
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:
The text was updated successfully, but these errors were encountered: