Skip to content

HALT()/ASSERT() do not abort in some compilers. #5

@TheDreadedAndy

Description

@TheDreadedAndy

In common/IErrors.cpp, IErrors_Halt() stops the plugin with:
*((int *)0) = 0xDEADBEEF;
This is undefined behavior. Some compilers (e.g. clang and clang-cl) will always optimize this out.

In order to achieve the desired result, the function body needs to be either:
*((volatile int*)0) = 0xDEADBEEF
or, using an x86ism:
__asm__ __volatile__("ud2");
__builtin_unreachable();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions