在 2025-6-25 20:17, Martin Storsjö 写道:
Previously, the compiler would know for certain, that the
written pointer is a null pointer, which is UB. Therefore,
Clang would assume that the UB code is unreachable, and not
generate any code for anything after the call to printf.

Move the pointer variable to the global scope, to make the
compiler unable to assume anything about its value here,
retaining the write and the rest of the main function.

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 | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)



This change Looks good to me.




--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to