Aggressive optimization of goto labels: Error: Goto label optimized away + Internal error 2007050701 IE2007050701
FPC [main]
In the process of researching this issue #41438 (closed), I encountered the following problem:
Optimization level: >= -O2
:
program app;
procedure kek(value: UInt32);
label
mylabel;
begin
while value shr 24 = 0 do
begin
mylabel:
end;
if Random>0.0 then
begin
goto mylabel;
end;
end;
begin
end.
Output: Error: Goto label "mylabel" not defined or optimized away
There are certainly questions about the correctness of the code, but Delphi, for example, compiles this code successfully. I don't know how much of a bug this is
-O3
: Internal error 2007050701
Edited by alligator