VOGONS


First post, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I'm getting an exception when executing a CONFIG command with any parameter specified. I traced it to a FOR instruction in GetParameterFromList()

for(Bitu i = 0; params[i]!=""; i++) {

The loop is not ending on the last element, so it tries to process past the end of the array. I thought the empty string might be an issue, but changing the last element to some string value like "endlist" and testing for that still doesn't end the loop. Maybe a bug in the version of GCC I'm using, but this works:

for(Bitu i = 0; strlen(params[i])>0; i++) {

Reply 1 of 2, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Could it be an optimization problem?
If you log params=="" inside the for-loop, does it match the != check in the for-declaration?

Reply 2 of 2, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I use these compile flags for testing:

CXXFLAGS="-s -O2 -fomit-frame-pointer -ffast-math -march=i586 -mtune=i686"

Seems fairly conservative, and nothing in there sticks out as being problematic. Using more optimized flags for my specific processor type doesn't help.

Hmm, strcmp() works but == and != are not working for the params array elements at all, either in the FOR condition or anywhere in the function. Is it supposed to be that way, or a problem with GCC?