View Single Post
Old 06 October 2021, 09:17   #1295
BSzili
old chunk of coal
 
BSzili's Avatar
 
Join Date: Nov 2011
Location: Hungary
Posts: 1,293
I updated to the latest version and made a clean build, but ran into an issue where the C++ destructors for global objects now cause illegal instruction crashes. It only seems to happen if there's a function call in the destructor. I created a minimal example that reproduces the issue. This is what I have in dest.cpp:
Code:
#include <unistd.h>

class Resource
{
public:
    Resource(void);
    ~Resource(void);
    int handle;
};

Resource::Resource(void)
{
    handle = -1;
}

Resource::~Resource(void)
{
    if (handle != -1)
    {
        close(handle);
    }
}

Resource gRes;

int main(void)
{
	return 0;
}
I build it with
m68k-amigaos-g++ -Wall -noixemul -m68060 -m68881 -fbbb=- -fno-peephole2 -fomit-frame-pointer -O2 -fno-strict-aliasing -fno-exceptions -fno-rtti -o dest dest.cpp
but building with
m68k-amigaos-g++ -noixemul -o dest dest.cpp
also reproduces the crash.
I replaced __initcpp and __exitcpp with my own Printf-loaded wrappers to verify that the crash happens in __exitcpp when it calls the first offending destructor. What could be the cause of this?
BSzili is offline  
 
Page generated in 0.04785 seconds with 11 queries