https://git.reactos.org/?p=reactos.git;a=commitdiff;h=95671c25ecbec6d69f7e5…
commit 95671c25ecbec6d69f7e55d9a7f74707798154fd
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sun Mar 31 08:40:36 2019 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Mon Apr 1 11:38:32 2019 +0200
[CMAKE] Add -fno-aggressive-loop-optimizations flag
ReactOS/Windows headers contain lots of structures whose last field is
fieldName[ANYSIZE] or fieldName[1].
Starting with GCC 4.8, gcc considers that accessing items [2], [3], ...
are undefined operation, and may optimize those accesses by removing them!
Add flag -fno-aggressive-loop-optimizations to prevent this unwanted behaviour.
---
sdk/cmake/gcc.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index 4c83f508f7..bd29a0f98e 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -46,6 +46,7 @@ add_compile_flags("-nostdinc")
if(GCC_VERSION VERSION_GREATER 4.7)
add_compile_flags("-mstackrealign")
+ add_compile_flags("-fno-aggressive-loop-optimizations")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")