Problem with old compilers

Discussions related to the BB4W & BBCSDL interpreters and run-time engines
Richard Russell
Posts: 366
Joined: Tue 18 Jun 2024, 09:32

Problem with old compilers

Post by Richard Russell »

I've noticed that BBC BASIC for SDL 2.0 (BBCSDL) and the BBC BASIC Console Mode editions (BBCTTY) can occasionally give the wrong result from an integer multiplication if compiled with a very old version of GCC (earlier than major version 5). It's most unlikely that such an old version of GCC will be encountered but unfortunately some 'GCC compatible' compilers report that they are GCC version 4! :o

One such compiler is EMCC, the Emscripten compiler, used to build the in-browser version of BBCSDL (it was on this platform that I discovered the problem). It's possible that some versions of Clang also pretend to be an early version of GCC. Sadly, therefore, this bug can be encountered 'in the wild' when you would not expect it to. :(

I will of course fix this in the next release, but in the meantime be aware of the possibility of this happening. It definitely should not misbehave when 'genuine' GCC was used to compile it, which includes the Windows, Linux and Raspberry Pi editions.