View Issue Details

IDProjectCategoryView StatusLast Update
0035820FPCCompilerpublic2020-07-26 14:26
ReporterAkira1364 Assigned ToFlorian  
Status resolvedResolutionfixed 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0035820: Any use whatsoever of "label" and "goto" in a procedure marked as inline crashes the compiler.
DescriptionI'm aware that inline would not be supported (AFAIK) for methods containing gotos in the first place, however, that's a different thing than hard-crashing the compiler (with no real error message).
Steps To ReproduceAttempt to compile the following example program:

program BugExample;

{$mode ObjFPC}

type SubRange = 1..3;

  procedure Blah(const I: SubRange); inline;
    B: Boolean = True;
      case I of
          if B then
            B := False;
            goto Top;

  procedure DoIt;


Note that if "inline" is removed, it compiles without issues and runs as expected.
TagsNo tags attached.
Fixed in Revision43793
Attached Files


has duplicate 0031714 closedFlorian Compiler: Access Violation on inlined procedure using a local goto instruction 
related to 0037420 resolvedFlorian [Patch] Fix for incorrect alignment removal 



2019-07-10 15:37

reporter   ~0117137

Last edited: 2019-07-10 17:11

View 4 revisions

Hmm. It appears I was somewhat wrong:

In fact, inlining does not *always* crash the compiler in conjunction with label / goto, and procedures containing them *can* be successfully inlined.

For example:

  procedure Infinite; inline;
    goto Bad;

  procedure LoopForever;

Examining the assembler output for that shows that "Infinite" is indeed fully inlined into "LoopForever".

I think the issue might actually be something to do with the specific presence of case blocks, as existed in my main example of the bug.

Serge Anvarov

2019-07-10 22:46

reporter   ~0117151

My compiler doesn't crash, but eats up memory until I kill it. FPC 3.0.4 and FPC 3.1.1, both x64. Windows 7.

Issue History

Date Modified Username Field Change
2019-07-10 15:11 Akira1364 New Issue
2019-07-10 15:37 Akira1364 Note Added: 0117137
2019-07-10 15:39 Akira1364 Note Edited: 0117137 View Revisions
2019-07-10 15:39 Akira1364 Note Edited: 0117137 View Revisions
2019-07-10 17:11 Akira1364 Note Edited: 0117137 View Revisions
2019-07-10 22:46 Serge Anvarov Note Added: 0117151
2019-07-11 02:15 J. Gareth Moreton Priority normal => high
2019-07-11 02:15 J. Gareth Moreton Severity minor => crash
2019-07-11 02:15 J. Gareth Moreton FPCTarget => -
2019-12-25 17:10 Florian Assigned To => Florian
2019-12-25 17:10 Florian Status new => resolved
2019-12-25 17:10 Florian Resolution open => fixed
2019-12-25 17:10 Florian Fixed in Version => 3.3.1
2019-12-25 17:10 Florian Fixed in Revision => 43793
2020-07-26 11:07 Jonas Maebe Relationship added has duplicate 0031714
2020-07-26 12:01 J. Gareth Moreton Relationship added related to 0037420