English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   support.WinUAE (https://eab.abime.net/forumdisplay.php?f=5)
-   -   ** Stack Overflow ** trying to run program in WinUAE (https://eab.abime.net/showthread.php?t=92456)

Audiorulz4u 18 May 2018 20:21

** Stack Overflow ** trying to run program in WinUAE
 
I am trying to run a program withen WinUAE that i compiled from source code.. the program compiles fine however when ever i try and run the program i get a Stack overflow error.. digging around in the code the fuction its failing on is a function call of srandom(time(0)); any ideas on how to correct this?


Thanks,
Robert

Toni Wilen 18 May 2018 21:38

Assuming it is compiler's startup-code that does the stack check: use stack CLI command to set larger stack. (or add it to startup-sequence, default 4k is far too small today)

It has nothing to do with emulation.

Audiorulz4u 18 May 2018 22:10

set the stack to 9000000 bytes and still getting the stack overflow error

Audiorulz4u 18 May 2018 22:57

1 Attachment(s)
See Attached Screen Shot

Toni Wilen 19 May 2018 09:12

If program is unix port, it may need more than 64k of stack (but not 9M, 500k should be good test value).

Or it is using some compiler specific default stack size. Check compiler settings/documentation.

Audiorulz4u 21 May 2018 17:24

i've set it to 500k and even specified int _stack = 500000; in the config file and still get the stack over flow for whatever reason the program compiled wtih out any issues using SAS 6.5

meynaf 21 May 2018 20:39

This smells the infinite recursive call...
The program appears to be broken in some way.

Audiorulz4u 21 May 2018 20:50

the program crashs when it calls the srandom() function in the source code


The srandom() function initializes the calling thread's current state array for the random() function using the value of seed.

meynaf 21 May 2018 21:05

Doesn't mean the fault is there.
Look in the function which calls that srandom() thingy.
How is this function called ?

Audiorulz4u 22 May 2018 21:38

its called within the main() function just srandom(time(0));

meynaf 22 May 2018 22:05

Then there is no reason it should do a stack overflow.

Just to be sure, comment this line out and try again.
Noninitialized random seed should have a minimal impact and be fine for some debug testing.


All times are GMT +2. The time now is 15:45.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05081 seconds with 11 queries