Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Pentium-safe FDIV" ... in year 2014?

Everytime I look in the compiler settings, the same question comes into my mind: Why does the current compiler of Delphi still have the "Pentium-safe FDIV" compiler option?

The Pentium-FDIV-Bug was found in November 1994 and did not occur in CPU models of 1995. Processors at this time were probably only strong enough work with Windows 95, 98 and maybe also Me. As far as I know, the first Intel Pentium 1 CPU with 133 MHz (and therefore fast enough to reach the minimum system requirements of Windows 2000) was released in June 1995, without FDIV bug, of course.

The VCL/RTL of current Delphi versions makes use of Windows APIs which are not available in ancient Operating Systems. Windows 98 and Me do not work with an empty Delphi XE6 VCL application; I didn't check if the VCL/RTL of Delphi XE6 has already broken Windows 2000 compatibility, but I think so.

So, why does Embarcadero keep a compiler switch which was used in 1994, when they drop support for Operating Systems which were used in year 2000? Ergo, nobody will require this compile option, since the affected CPUs won't be compatible with the Operating Systems the VCL/RTL requires anyway.

Update; To clarify the question: Is there any use-case where this switch might be useful? Or maybe the compiler internally ignores the option, and it is just there to preserve the options for old project files?

like image 342
Daniel Marschall Avatar asked Jun 07 '14 20:06

Daniel Marschall


2 Answers

The Pentium divide bug affected a number of the very early Pentium models. The highest clock speed of the affected models was 100MHz. The official documents indicate that Delphi XE6 targets Vista and up, but in reality it is still possible to target Windows XP, and I believe that XE6 can make executables that run on Windows 2000. The minimum requirements for XP are a 233MHz processor, and for Windows 2000 a 133MHz processor.

So, it is just about plausible that you might be able to run code compiled by XE6 on a defective Pentium processor. In reality, nobody at Embarcadero, for at least the past 15 years, will have felt any obligation to support defective Pentium processors. They simply have not been seen in the wild in the 21st Century.

So, why has the compiler feature not been removed? Only Embarcadero know the answer to that but I can give a few obvious reasons:

  1. Removing the feature disturbs backwards compatibility. If there are people that, even if they don't need to, build with the switch enabled, then removing it will affect them.
  2. Removing the feature costs. Doing so involves changes to the UI, the compiler, the documentation, the test suite, etc.
  3. Removing the feature introduces risk. Any time you change code, code that is tried and tested over many years, you run the risk of introducing a new defect.
like image 99
David Heffernan Avatar answered Nov 04 '22 17:11

David Heffernan


If you're looking for an "official" answer, you're unlikely to get one. Unofficially, I can certainly point you to David's answer. His 3 points about the reasoning are clear. Unless there is a compelling reason to remove the feature, it doesn't make much business or technical sense. About the only reason it should be removed would be if the x86 back-end were completely rewritten from the ground up... in which case it's not so much as removed, rather it simply would not be taken into account in the first place.

I will note that the new AMD64/ia64 and LLVM-based ARM back-ends do not do anything with that directive since it should be axiomatic that those CPUs aren't effected. The directive/option is recognized, but merely ignored.

like image 24
Allen Bauer Avatar answered Nov 04 '22 15:11

Allen Bauer