Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes for a simple program #23

Closed
m0ppers opened this issue Apr 17, 2018 · 2 comments
Closed

Crashes for a simple program #23

m0ppers opened this issue Apr 17, 2018 · 2 comments

Comments

@m0ppers
Copy link

m0ppers commented Apr 17, 2018

I have a very minimal program that creates reproducable hard crashes for me in UAE:

#include <stdio.h>

class TestClass {
  public:
    TestClass(): count(0), structs() {
    }

    typedef struct {
        char path[256];
        char name[256];
        int test;
    } TestStruct;

    TestStruct structs[10];
    int count;
};

int main() {
    TestClass c;
    for (int i=0;i<10;i++) {
        printf("%s %s %d\n", c.structs[i].path, c.structs[i].name, c.structs[i].test);
    }
    return 0;
}

Didn't yet go down to assembly level. Will probably do so in the following days but maybe you have an immediate idea.

Compiled like this:

/home/mop/m68k-amigaos-gcc6/bin/m68k-amigaos-g++ -noixemul -m68030 -m68881 /mnt/d/le3d-amiga/testi.cpp -o testi

It seems to be related to the memory allocations of the struct array. The structs() should auto initialize every struct (and all its members recursively) to zero and does so on linux.

@bebbo
Copy link
Owner

bebbo commented Apr 19, 2018

what stacksize are you using? try stack 200000 and run it again.

EDIT:
the default stack size is 4096 and your program allocates 5160 bytes on the stack...

@bebbo bebbo closed this as completed Apr 19, 2018
@m0ppers
Copy link
Author

m0ppers commented Apr 20, 2018

wow...didn't know that (pretty new to the amiga stuff)...thank you...works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants