File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,24 @@ else()
124124 target_compile_options (dispatch PRIVATE -Wall)
125125endif ()
126126
127+ # Work around a release-mode miscompile on windows arm64
128+ # Disable /Os and /Ot in /O1 and /O2 on queue.c
129+ if (("${CMAKE_C_SIMULATE_ID} " STREQUAL "MSVC" ) AND
130+ (("${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "ARM64" ) OR
131+ ("${CMAKE_SYSTEM_PROCESSOR} " STREQUAL "aarch64" )))
132+ string (TOUPPER "${CMAKE_BUILD_TYPE} " uppercase_CMAKE_BUILD_TYPE)
133+ set (FLAGS_BUILD_TYPE "${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE} }" )
134+ string (REGEX MATCHALL "/[Oo][12]" FLAGS "${CMAKE_C_FLAGS} ${FLAGS_BUILD_TYPE} " )
135+ if (FLAGS )
136+ if (FLAGS MATCHES "1$" )
137+ set (FLAGS "/Od;/Og;/Oy;/Ob2;/GF;/Gy" )
138+ elseif (FLAGS MATCHES "2$" )
139+ set (FLAGS "/Od;/Og;/Oi;/Oy;/Ob2;/GF;/Gy" )
140+ endif ()
141+ set_source_files_properties (queue.c PROPERTIES COMPILE_OPTIONS "${FLAGS} " )
142+ endif ()
143+ endif ()
144+
127145# FIXME(compnerd) add check for -fblocks?
128146target_compile_options (dispatch PRIVATE -fblocks)
129147
You can’t perform that action at this time.
0 commit comments