`reference to procedure (aoc: array of const);` causes an access violation
Summary
type Aoc0 = reference to procedure (aoc: array of const);
during compilation causes an internal exception to be raised.
System Information
- Operating system: Linux 6.0.9-1.el9.elrepo.x86_64 NAME="AlmaLinux" VERSION="9.1 (Lime Lynx)"
- Processor architecture: x86-64
- Compiler version: 3.3.1-12182-g3b4c396e
- Device: Computer
Steps to reproduce
Given the following program:
program function_reference_array_of_const; {$modeswitch functionreferences}
type Aoc0 = reference to procedure (aoc: array of const);
type Aoc1 = reference to procedure (var aoc: array of const);
type Aoc2 = reference to procedure (constref aoc: array of const);
type Aoc3 = reference to procedure (const aoc: array of const);
begin end.
And without commenting out all the type Aoc...
lines, when compiled causes the following to occur:
$ fpc aocfr.pas
Free Pascal Compiler version 3.3.1 [2022/12/11] for x86_64
Copyright (c) 1993-2022 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling aocfr.pas
aocfr.pas(3,51) Error: Compilation raised exception internally
Fatal: Compilation aborted
An unhandled exception occurred at $00000000004D7463:
EAccessViolation: Access violation
$00000000004D7463
Error: /home/dev/fpc_usr/lib/fpc/3.3.1/ppcx64 returned an error exitcode
Example Project
See steps to reproduce.
What is the current bug behavior?
The compiler raises an Access violation exception.
What is the expected (correct) behavior?
Either an error message indicating the program could not be compiled or that the program be compiled.
I really feel it should be compiled as array of const
is a valid function parameter.
Relevant logs and/or screenshots
See steps to reproduce.
Possible fixes
None known, I've not looked that compiler code that is causing the exception to be raised.