“Pentium-safe FDIV” … in year 2014?

浪尽此生 提交于 2021-01-27 04:13:29

问题


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?


回答1:


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.



回答2:


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.




回答3:


Delphi still alows making of console applications. And unless your console application relies on newer windows API you could easily make it compatible with Windows 95.




回答4:


This is just hearsay, but apparently the Delphi compiler is written in assembly and basically unmaintainable. They don't remove any features simply because it's incredibly hard to do any kind of change in the compiler so they don't bother.



来源:https://stackoverflow.com/questions/24101125/pentium-safe-fdiv-in-year-2014

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!