View Issue Details

IDProjectCategoryView StatusLast Update
0035820FPCCompilerpublic2019-07-11 04:16
ReporterAkira1364Assigned To 
Status newResolutionopen 
Platformx86_64OSWindowsOS Version10
Product Version3.3.1Product BuildTrunk 
Target VersionFixed in Version 
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 Revision
Attached Files



2019-07-10 17:37

reporter   ~0117137

Last edited: 2019-07-10 19: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-11 00: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 17:11 Akira1364 New Issue
2019-07-10 17:37 Akira1364 Note Added: 0117137
2019-07-10 17:39 Akira1364 Note Edited: 0117137 View Revisions
2019-07-10 17:39 Akira1364 Note Edited: 0117137 View Revisions
2019-07-10 19:11 Akira1364 Note Edited: 0117137 View Revisions
2019-07-11 00:46 Serge Anvarov Note Added: 0117151
2019-07-11 04:15 J. Gareth Moreton Priority normal => high
2019-07-11 04:15 J. Gareth Moreton Severity minor => crash
2019-07-11 04:15 J. Gareth Moreton FPCTarget => -