mismatched {$POP} causes unhandled exception and access violation
Summary
When attempting to compile the provided example code, the compiler recognises that there is a POP compiler directive too many but bails out with an unhandled exception, followed by an access violation.
System Information
- Operating system: Linux (Debian based)
- Processor architecture: x86-64
- Compiler version: 3.2.2, trunk (march 31)
- Device: Desktop machine
Steps to reproduce
Use the push-pop-pop compiler directives like in the example code and compile the example.
Example Project
program onepoptoomanycrash;
{$PUSH}
{$POP}
{$POP}
begin
end.
What is the current bug behavior?
The compiler bails out with an unhandled exception followed by an access violation, also with trunk compiler.
What is the expected (correct) behavior?
A correct handled exception ?
Relevant logs and/or screenshots
compiler output:
fpc ./onepoptoomanycrash.pas
Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling ./onepoptoomanycrash.pas
onepoptoomanycrash.pas(4,4) Error: A POP without a preceding PUSH
onepoptoomanycrash.pas(4,4) Error: Compilation raised exception internally
Fatal: Compilation aborted
An unhandled exception occurred at $00000000004715D9:
EAccessViolation: Access violation
$00000000004715D9
In the hope it is useful.