The null pointer access in itself is UB, and Clang would previously optimize based on that being UB, assuming that that code is unreachable, so it would assume that the printf function never returns and not generate any code after that call.
Change the pointer into a volatile char, which makes Clang not infer things about it in the same way, and actually retain the null pointer write. This fixes hangs in this testcase on armv7 with msvcrt. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-crt/testcases/t_nullptrexception.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/testcases/t_nullptrexception.c b/mingw-w64-crt/testcases/t_nullptrexception.c index d1ae83c24..78e468bcb 100644 --- a/mingw-w64-crt/testcases/t_nullptrexception.c +++ b/mingw-w64-crt/testcases/t_nullptrexception.c @@ -2,7 +2,7 @@ int main() { - char *p = NULL; + volatile char *p = NULL; printf ("Raise uncaught NULL pointer exception...\n"); *p = 0; -- 2.43.0 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public