Skip to content

LLVM -gt crash

Summary

-gt in a procedure with a nested procedure crashes

System Information

  • Operating system: Linux
  • Processor architecture: x86-64
  • Compiler version: trunk 81a7da51 clang-13

Steps to reproduce

-MObjFPC -Scgi -Cg -O1 -g -gl -gt -l -vewnhibq

Example Project

program Project1;

type TLLVMTest = class
  str: ansistring;
  pos: pchar;
  procedure expect(c: char);
  procedure test();
end;
var
  l: TLLVMTest;

procedure TLLVMTest.expect(c: char);
  procedure error;
  begin
    while (pos^ <> c) and (pos^ <> #0) do pos += 1;
  end;

begin
  writeln(pos <> nil); 
//  if pos^ = c then pos += 1
//  else error();
end;

procedure TLLVMTest.test();
begin
  str := 'abc';
  pos:=@str[1];
  expect('a');
end;


begin
  l := TLLVMTest.create;
  l.test();

end.

What is the current bug behavior?

It crashes

What is the expected (correct) behavior?

It should not crash

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