Skip to content

Segmentation fault in MockImpl::unmocked() when compiled with mingw64 #362

Description

@adbancroft

This code crashes when compiled with [mingw64, Windows 11, gcc v15.2.0] but correctly throws an exception on [ubuntu 22.04, gcc 13.0.0]. AFAIK, both are compiled with the same set of flags.

The crash occurs on the fakeit.handle(event); in the unmocked() method:

        void unmocked() {
            ActualInvocation<> invocation(Invocation::nextInvocationOrdinal(), UnknownMethod::instance());
            UnexpectedMethodCallEvent event(UnexpectedType::Unmocked, invocation);
            auto &fakeit = getMockImpl(this)->_fakeit;
            fakeit.handle(event);

            std::string format = fakeit.format(event);
            UnexpectedMethodCallException e(format);
            throw e;
        }

Debugger shows fakeit with a zero address on mingw64?

Is there some magic compiler flag that should be applied on mingw64?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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