PENTIUM CPU target generates invalid opcode
Summary
Trying to build a DOS/go32v2 project that targets the PENTIUM instruction set (-CpPENTIUM) generates code with an invalid instruction set.
System Information
- Operating system: Linux (target OS is go32v2)
- Processor architecture: x86
- Compiler version: trunk 67eac52f
- Device: Computer
Steps to reproduce
- Write a simple program
begin writeln('hi') end.
as foo.pas - Compile it with
fpc -CpPENTIUM -Tgo32v2 -Pi386 foo
- Run it in a DOS environment that can restrict CPU type to Pentium (e.g. DOSBOX, 86box, PCem, etc) - you'll also need cwsdpmi.exe for this
- You get an Invalid Opcode error: Invalid Opcode at eip=badb (or some other address); flags=3206, register dump
Example Project
See the simple program above.
What is the current bug behavior?
The compiler generates invalid opcodes.
What is the expected (correct) behavior?
The compiler should restrict itself to the requested CPU.
Relevant logs and/or screenshots
No logs but one thing that might be related is that if optimizations for PENTIUM are also enabled, the compiler can hang. This does not happen with the simple hello world program above but it does happen when i try to build a DOS 3D game engine which can found at http://runtimeterror.com/tech/petra/ (version 0.2) with ./build.sh dos release
(the "release" parameter enables the optimizations).
Note that this is a regression as release 3.2.2 works fine.