Skip to content

Compiler fails with segmentation fault when derefence is missing

Summary

Compiler fails with segmentation fault when derefence is missing. The phenomenon demonstrates itself in ObjFPC mode, possibly others.

System Information

  • Operating system: Linux Mint 21 Cinnamon, 64 bit, Linux Kernel: 5.15.0-53-generic
  • Processor architecture: x86-64
  • Compiler version: 3.2.2
  • Device: Computer

Steps to reproduce

Compile the provided example:

Example Project

program Project1;
 
type
  PA_Node = ^TA_Node;
  TA_Node = array[0..3] of PA_Node;
 
  var n1,n2:PA_Node;
begin
  n2 := nil;
  n1[3] := n2; // Panic (1002) Target OS: Linux for x86 ppcx64 can't be executed; error code -139
//   n1^[3] := n2; // this of course works, I would just expect less panic for just forgotten caret
end.

What is the current bug behavior?

Compiler fails with segmentation fault

What is the expected (correct) behavior?

Compiler does not fail and produces error message

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information