Closed mheyer32 closed 5 years ago
no idea - sorry. If it runs ok with -fbbb=-
then I'm the cause again
Well, one data point: it got nothing to do with -fbbb; problem reproduces with -fbbb=-
Oh, I think I know whats going on. The first crash happens in '__swbuf()' which is probably part of the runtime libs. If they are using enums and have not compiled with -fshort-enums, ScummVM will have a hard time calling into the runtime libs for anything that stores or accepts enums.
Is there a central point in the toolchain where the compile flags for the various runtlime libs are adjusted? I'd like to run a experiment to see if this could be made working by compiling the runtime libs with -fshort-enums, too.
Update: These seem to be the only enums in libnix:
./sources/headers/socket.h:typedef enum {LX_NONE, LX_AMITCP, LX_AS225} LX_NETWORK_TYPE; ./sources/headers/stdio.h:typedef enum {LX_FILE,LX_SOCKET} LX_FILE_TYPE;
you might try CFLAGS_FOR_TARGET
but also use -O2 otherwise exception handling seems to be broken
adding -fshort-enums to CFLAGS_FOR_TARGET got rid of the issue.
Now I wonder if it's worth using -fshort-enums on m68k as standard (i.e. have it always enabled) ? Would it have any adverse side effects?
The Pro arguments are: less storage, tighter packing of enums, thus less bandwidth/better cache usage on our puny cpu. Con: ?
no idea - short vs int is not always a win.
Hold on, the problem did not go away... it just moved somewhere else... The pathfinding in Discworld now works while Sierra games don't even start up anymore. As if shifting things around a bit just moved the problem somewhere else. :-(
This might take a while to figure out.
Re: "no idea - short vs int is not always a win."
In many (most?) cases enums are rather small and fit into just a byte.
I am still investigating issues with -fshort-enums;
After recent fixes inthe compiler, the issue has become more elusive. I'm starting to believe it might be a compiler bug :-)
The issue I mentioned in https://github.com/bebbo/gcc/issues/70#issuecomment-465459655 is not related. That was just assert() aborting and in turn my outdated libnix causing writes to NULL when writing to stderr.
I tracked it down to a serialization issue in Tinsel. I think -fshort-enums is working fine.
In an attempt to make things a bit faster (smaller structs, smaller data for enums), I opted for -fshort-enums in ScummVM. Weird thing is: -fshort-enums it breaks ScummVM in a very subtle manner. It still largely runs, but the Tinsel engine (Discworld) starts having issues with pathfinding...
Now, before I dive deep into assembly, is there anything Amiga specific about -fshort-enums that I should know about? Anything I should look out for?