FreeBASIC 1.01.0 - illegal instruction

Windows specific questions.
Post Reply
DamageX
Posts: 130
Joined: Nov 21, 2009 8:42

FreeBASIC 1.01.0 - illegal instruction

Post by DamageX »

I was testing code on old machines today (and ran into some DOS issues that I'll have to post about later), and downloaded the latest FreeBASIC to see if it made any difference...

Nothing compiled with 1.01.0 runs on my NT4 machine (Pentium MMX). Even a "hello world" program fails with an illegal instruction 0xC000001D, Address 0x004012F0
D.J.Peters
Posts: 8641
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC 1.01.0 - illegal instruction

Post by D.J.Peters »

In case of DOS (i don't have NT4 or 95,98,me anymore)
I installed fbc 1.1 on dosbox with 486 enabled and fbc
print "hello"
sleep

fbc hello.bas
hello
outputs illegal instruction
but if i overwrite the default value of -arch
fbc -v -arch 386 hello.bas
fbc -v -arch 486 hello.bas
fbc -v -arch 586 hello.bas
fbc -v -arch 686 hello.bas
fbc -v -arch pentium-mmx hello.bas
all print "hello" and wait for a key

May be it works on your NT4 also.

Joshy
DamageX
Posts: 130
Joined: Nov 21, 2009 8:42

Re: FreeBASIC 1.01.0 - illegal instruction

Post by DamageX »

With FB 1.01.0 DOS, I can compile and run stuff no problem.

With FB 1.01.0 Win32, I can't compile or run stuff on the Pentium MMX. Not in NT3.51, not in NT4, not in Win98. But OS doesn't seem to be the issue anyway, because it worked fine everywhere else:

NT3.51 on a Pentium M
XP on a Pentium M
2000 on an Athlon XP
Win 7 32-bit on a Core 2

Using the -arch switch didn't seem to make a difference.
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: FreeBASIC 1.01.0 - illegal instruction

Post by dkl »

Hm, I don't remember seeing that before. I'm wondering, does the same happen with other FB releases (e.g. FreeBASIC-1.00.0-win32)?

In general, it's probably related to the precompiled gcc/mingw-w64 libraries which have shown before that they don't play well with older Windows systems. Although, I'm not sure how it relates to older processors. Maybe they use some SSE2 instructions which the Pentium MMX didn't support (I'm not sure whether that's even correct), or something like that?

Does it work with the alternative FreeBASIC-1.01.0-win32-mingworg package? (That's made with a different gcc/mingw setup and used to work on older Windows systems, so possibly it could work in your case aswell)
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: FreeBASIC 1.01.0 - illegal instruction

Post by marcov »

I think even more basic, Pentium MMX doesn't support Pentium Pro/II instructions like cmov/sysenter/sysexit and SSE-1 (including prefetch* and some atomic (multi processor) primitives)

Solution: keep a watch on the dumpster, and soon you will have ten better systems. Then dump the MMX.
DamageX
Posts: 130
Joined: Nov 21, 2009 8:42

Re: FreeBASIC 1.01.0 - illegal instruction

Post by DamageX »

Does FreeBASIC officially require Pentium Pro or Pentium III (SSE)? I was not aware of such a requirement, but if true then I won't waste my time running tests.
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: FreeBASIC 1.01.0 - illegal instruction

Post by marcov »

I mostly said that because many GNU (and other) tools nowadays are compiled for 686+. The reason for that is because that processor introduced handling for damage control for branching in combination with deep pipelines that are still the same in modern processors.

FB's rtlib is C compiled, so codegeneration options there matter. Same for packaged utils (on windows) like make, LD and as, and gcc in cgen's case.

IOW 686 generated code should execute much better on modern processors than 586 code with its handcoded u-v pipelining model.

Most linux distributions won't even run on such systems anymore. I found out the hard way, because some low power x86 processors from other vendors (like VIA C3) were not ppro compatible even though they were more modern and faster, in the GHz range. Newer VIA processors (like Nano) are compatible and even 64-bit (and thus SSE2) though.
dodicat
Posts: 8267
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC 1.01.0 - illegal instruction

Post by dodicat »

DamageX wrote:Does FreeBASIC officially require Pentium Pro or Pentium III (SSE)? I was not aware of such a requirement, but if true then I won't waste my time running tests.
Pentium Pro cannot handle FreeBasic graphics since about version 18.

I think at least mmx is required, which Pentium Pro doesn't have.
Pentium 3 works OK.
I have not tested Pentium 2.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Re: FreeBASIC 1.01.0 - illegal instruction

Post by DOS386 »

DamageX wrote:I was testing code on old machines today (and ran into some DOS issues that I'll have to post about later), and downloaded the latest FreeBASIC to see if it made any difference ... Nothing compiled with 1.01.0 runs on my NT4 machine (Pentium MMX). Even a "hello world" program fails with an illegal instruction 0xC000001D, Address 0x004012F0
http://freebasic.net/forum/viewtopic.ph ... 86#p204186

The illegal instruction is CMOVNTQ ... maybe it would work on NT4 (it works on ME again), but it doesn't work on P1, since libraries are apparently precompiled with "March=686/P3_with_CMOVNTQ". I haven't yet tested in what version the problem came up. But 1.00.0 and it's output don't run on ME, this somewhat limits the possibilities to test on old CPU's (try HX). I don't have NT4 to test.
Post Reply