Found something deep in the tclcompiler module ...
In cmpWrite.c, function A85EncodeBytes.
I prepare bytesPtr (which points to 4 bytes in memory) to point to the value 0x84000000 which is -2080374784 in decimal.
There are two consecutive "if (word < 0) ..." in the function. The value of "word" after the first if is 544172512, the second if should never be entered. However, with optimizations of -O2 or above the code is executed! Depending on the specific version of MinGW I get different results for word then: -
2147483648 (MinGW8.1.0) or -1126247488 (MinGW5.1.0). A negative value is clearly wrong to proceed with. The final result is that the generated .tbc file contains most likely some NULL bytes (it does for me). The encodeMap array is accessed with a negative index but it is usually surrounded by NULL bytes, therefore the likely result of NULL bytes in the .tbc file.
A quick workaround is to declare "word" as volatile. Will perhaps look at what MinGW's assembler output later this week or month to see what's going wrong.
Also, I don't really understand the comment /* Because some don't support unsigned long */. Wow, there must be some really special compilers out there. Some of the stuff in the source could really take advantage of unsigned arithmetic (or a rewrite in general, some parts are offensively ugly). And how old is this module? It's written in K&R style.
Well, that's about the problem I found. I have no idea if it is related to Manfred's problem, but if there's one problem with MinGW there may well be lurking more.
Hey Manfred ... can you look into your generated .tbc files if they contain NULL bytes? Would be a hint.