Why is this an issue?

The noreturn directive tells the compiler that a routine will never return normally. The compiler uses this information to optimize code and suppress warnings about unreachable code after calls to the routine. If a routine marked noreturn can actually return normally, the compiler's assumptions are violated, which can lead to incorrect code generation and unpredictable behavior.

Every code path in a noreturn routine must end with a raise statement, a call to Halt, or a call to another noreturn routine.

How to fix it

Ensure that every code path in the routine ends by raising an exception, calling Halt, or calling another noreturn routine. Alternatively, remove the noreturn directive if the routine is intended to return normally.

procedure FatalError(const Msg: string); noreturn;
begin
  WriteLn(Msg);
end;
procedure FatalError(const Msg: string); noreturn;
begin
  WriteLn(Msg);
  raise Exception.Create(Msg);
end;

Resources