diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp index 262db73d72..298a74d2b0 100644 --- a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp +++ b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -26,15 +27,33 @@ ** ****************************************************************************/ - -struct Foo +void crashFallback(volatile int *ptr = nullptr) { - int i; -}; + *ptr = 0; +} + +#if defined(_MSC_VER) +# include int main() { - *(volatile char*)0 = 0; - Foo *f = 0; - return f->i; +# if defined(_M_IX86) || defined(_M_X64) + __ud2(); +# endif + + crashFallback(); } +#elif defined(__MINGW32__) +int main() +{ + asm("ud2"); + crashFallback(); +} +#else +# include + +int main() +{ + abort(); +} +#endif