View Issue Details

IDProjectCategoryView StatusLast Update
0034210FPCCompilerpublic2018-09-07 13:31
ReporterAnton KavalenkaAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.1.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0034210: fpc: Recent management operator changes read to i386-linux compiler crash on freeing operators
DescriptionCrash occurs only on rebuild (-B) of one specific project at compiler cleanup
Error: Compilation raised exception internally
Fatal: Compilation aborted
An unhandled exception occurred at $00000000:
EAccessViolation: Access violation
  $00000000
  $081CDAF7
  $08069534

Stacktrace as follows:
#0 ?? at :0
0000001 SYSTEM$_$TOBJECT_$__$$_FREE at :0
0000002 TABSTRACTRECORDSYMTABLE__DESTROY(<incomplete type>, 0xb6614360) at symtable.pas:1192
0000003 SYSTEM$_$TOBJECT_$__$$_FREE at :0
0000004 TRECORDDEF__DESTROY(<incomplete type>, 0xb704d920) at symdef.pas:4607
0000005 SYSTEM$_$TOBJECT_$__$$_FREE at :0
0000006 TFPOBJECTLIST__CLEAR(0xb675c4a0) at cclasses.pas:1045
0000007 TSYMTABLE__CLEAR(0xb6833e60) at symbase.pas:306
0000008 TSYMTABLE__DESTROY(<incomplete type>, 0xb6833e60) at symbase.pas:244
0000009 SYSTEM$_$TOBJECT_$__$$_FREE at :0
0000010 TMODULE__DESTROY(<incomplete type>, 0xb7f08460) at fmodule.pas:727
0000011 TPPUMODULE__DESTROY(<incomplete type>, 0xb7f08460) at fppu.pas:165
0000012 SYSTEM$_$TOBJECT_$__$$_FREE at :0
0000013 PROC_PROGRAM(true) at pmodules.pas:2430
0000014 COMPILE('crl4000m.dpr') at parser.pas:393
0000015 COMPILE(0x0) at compiler.pas:278
0000016 main at pp.pas:263

Tracing shows that AV occurs on freeing of INITIALIZE management operator of one specific packed record.

  TStaticTemp=array[0..4] of word; // Tinj, 0,0,0, Tdet
  TStaticGas=array[0..7] of word; // G1,G2,G3,0,0,0,H2,Air

  Tm0Buf=packed record
    wPad:word; // 02 00?
    wGas:TStaticGas;
    bPad5:array[0..4] of byte; // 5-byte pad?
    // 19-word block
    press:TPressBlock;
    wUnk4:word; // 00 64 ?
    wPad8:array[0..7] of word; // zeroes
    // end 19-word block
    blk:TBlocking;
    bFlags:TFlags64; // 64 64
    bFlag:byte; // 19
    wPad1:word; // 01 00
    rProg:TRampProg;
    wTemps:TStaticTemp;
    wPad5:array[0..4] of word;
    wUnk1:word; // 08 1C
    wPad9:array[0..8] of word;
    bPad2:byte;
  end;

a unit with records linked to simple project and even record allocation does not produce error.

Steps To ReproduceI will try to minimize project.
Additional Informationx86_64-linux is not affected

Also - is not the management operator freeing should look like this?
symtable:1186
          for mop in tmanagementoperator do
          begin
            if assigned(mop_list[mop]) then
            begin
              for i:=0 to mop_list[mop].count-1 do
                dispose(pmanagementoperator_offset_entry(mop_list[mop][i]));
          ->>>> mop_list[mop].free;
            end;
          end;
        inherited destroy;
TagsNo tags attached.
Fixed in Revision39693
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0034212 closedSven Barth revision 39693 breaks cross compiling the package libxml2 

Activities

Anton Kavalenka

2018-08-31 17:31

reporter  

test.zip (5,340 bytes)

Anton Kavalenka

2018-08-31 17:33

reporter   ~0110414

uploaded test that crashes i386-linux compiler

/usr/local/lib/fpc/3.3.1/ppc386 -B -MDelphi -O2 -XX -Tlinux -Pi386 -FE. a.dpr

Sven Barth

2018-08-31 21:18

manager   ~0110423

Now that was an unexpected one. O.o Shows that even I still learn things about the compiler, like that the symtables are reference counted which plays a role if a "type XXX" declaration is encountered - as is the case in your code.

Anyway, please test and close if okay.

Anton Kavalenka

2018-09-03 18:29

reporter   ~0110477

Last edited: 2018-09-03 18:30

View 2 revisions

ppc386 compiles properly the test program


/usr/local/lib/fpc/3.3.1/ppc386 tb0650.pp
Free Pascal Compiler version 3.3.1 [2018/09/03] for i386
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling tb0650.pp
21 lines compiled, 0.4 sec

ppcross386 built for i386-darwin fails either compiling to linux and to darwin

/opt/cross/lib/fpc/3.3.1/ppcross386 -Tdarwin tb0650.pp
Free Pascal Compiler version 3.3.1 [2018/09/03] for i386
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling tb0650.pp
Assembling (pipe) tb0650.s
21 lines compiled, 0.3 sec
Error: Compilation raised exception internally
An unhandled exception occurred at $00000000:
EAccessViolation: Access violation
  $00000000 of (Unknown file)

/opt/cross/lib/fpc/3.3.1/ppcross386 tb0650.pp
Free Pascal Compiler version 3.3.1 [2018/09/03] for i386
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling tb0650.pp
21 lines compiled, 0.1 sec
Error: Compilation raised exception internally
An unhandled exception occurred at $00000000:
EAccessViolation: Access violation
  $00000000 of (Unknown file)

symptoms very similar, .o and .ppu files are produced

Thaddy de Koning

2018-09-03 22:26

reporter   ~0110481

arm32-linux is ok. Seems related to Darwin, but I can't test that anymore.

Sven Barth

2018-09-04 22:29

manager   ~0110497

Please try again with revision 39711. If it compiles again then the problem is in fact the same as 0034212 and this one can be closed, because it has been correctly fixed.

Anton Kavalenka

2018-09-05 13:50

reporter   ~0110515

test tb0650.pp and all my projects compiled with r39711

i386 linux - OK
i386 cross linux - OK
i386 cross linux->darwin - OK

Sven Barth

2018-09-06 21:03

manager   ~0110543

Then I'm resolving this again.

Issue History

Date Modified Username Field Change
2018-08-31 15:56 Anton Kavalenka New Issue
2018-08-31 17:31 Anton Kavalenka File Added: test.zip
2018-08-31 17:33 Anton Kavalenka Note Added: 0110414
2018-08-31 21:18 Sven Barth Fixed in Revision => 39693
2018-08-31 21:18 Sven Barth Note Added: 0110423
2018-08-31 21:18 Sven Barth Status new => resolved
2018-08-31 21:18 Sven Barth Fixed in Version => 3.3.1
2018-08-31 21:18 Sven Barth Resolution open => fixed
2018-08-31 21:18 Sven Barth Assigned To => Sven Barth
2018-09-03 17:32 Anton Kavalenka Status resolved => closed
2018-09-03 18:29 Anton Kavalenka Note Added: 0110477
2018-09-03 18:29 Anton Kavalenka Status closed => feedback
2018-09-03 18:29 Anton Kavalenka Resolution fixed => reopened
2018-09-03 18:30 Anton Kavalenka Note Edited: 0110477 View Revisions
2018-09-03 22:26 Thaddy de Koning Note Added: 0110481
2018-09-04 22:29 Sven Barth Note Added: 0110497
2018-09-04 22:29 Sven Barth Relationship added related to 0034212
2018-09-05 13:50 Anton Kavalenka Note Added: 0110515
2018-09-05 13:50 Anton Kavalenka Status feedback => assigned
2018-09-06 21:03 Sven Barth Note Added: 0110543
2018-09-06 21:03 Sven Barth Status assigned => resolved
2018-09-06 21:03 Sven Barth Resolution reopened => fixed
2018-09-07 13:31 Anton Kavalenka Status resolved => closed