View Issue Details

IDProjectCategoryView StatusLast Update
0037316FPCRTLpublic2020-07-14 14:43
ReporterPetr-K Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1 
Summary0037316: VarArrayLock does not work
DescriptionIf example compiled with trunk (Linux x86-64) i get:

EAccessViolation: Access violation
  $000000000043CB26 SYSVARARRAYPUT, line 2677 of rtl-objpas/src/inc/variants.pp
  $000000000041B799 fpc_vararray_put, line 104 of ../inc/variant.inc
  $000000000040039D main, line 14 of vararray.pas
  $000000000042F925 SYSENTRY_INITTLS, line 333 of system.pp

Compiled with fpc-3.2.0, 3.1.1, or olders works ok.
Steps To Reproduceuses
  Variants;
type
  T = array[0..1] of Variant;
var
  v: Variant;
  P: ^T;
begin
  v := VarArrayCreate([0, 1], varVariant);
  v[0] := VarArrayCreate([0, 0], varVariant);
  v[1] := VarArrayCreate([0, 0], varVariant);
  P:=VarArrayLock(v);
  P^[0][0] := 'X';
  P^[1][0] := 'Y'; //<-Access violation
  VarArrayUnlock(v);
  writeln(v[0][0]);
  writeln(v[1][0]);
end.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Marco van de Voort

2020-07-12 14:40

manager   ~0123929

Since it is TLS related, does the problem change if you use cthreads unit?

Sven Barth

2020-07-12 21:22

manager   ~0123943

I think the TLS in the stack trace is a red hering. It's simply what originally called the "main" (aka PascalMain) function.

Petr-K

2020-07-13 07:54

reporter   ~0123951

I use this piece of code in the biger project which use cthreads with the same behaviour.

Marco van de Voort

2020-07-13 09:15

manager   ~0123953

I tried to reproduce with windows, but that went fine. If somebody else doesn't try to reproduce under 64-bit linux, I will whenever I boot to linux again.

Petr-K

2020-07-14 14:43

reporter   ~0124007

Test on i386 Linux and Windows without problem.

But compiled on win64 with Free Pascal Compiler version 3.3.1 [2020/07/14] for x86_64:

An unhandled exception occurred at $0000000100019873:
EAccessViolation: Access violation
  $0000000100019873 SYSVARARRAYPUT, line 2676 of rtl-objpas/src/inc/variants.pp
  $000000010000A1AA fpc_vararray_put, line 104 of ../inc/variant.inc
  $00000001000019D2 main, line 14 of vararray.pas
  $0000000100001B46 MAIN_WRAPPER, line 74 of system.pp
  $0000000100010DE0 EXE_ENTRY, line 203 of system.pp
  $0000000100001800 _FPC_MAINCRTSTARTUP, line 106 of sysinit.pp
  $0000000077D5964C

compiled without fpc.cfg
fpc -gl -Fuo:/pp/units/$fpctarget/* vararray.pas

Issue History

Date Modified Username Field Change
2020-07-08 16:43 Petr-K New Issue
2020-07-12 14:40 Marco van de Voort Note Added: 0123929
2020-07-12 21:22 Sven Barth Note Added: 0123943
2020-07-13 07:54 Petr-K Note Added: 0123951
2020-07-13 09:15 Marco van de Voort Note Added: 0123953
2020-07-14 14:43 Petr-K Note Added: 0124007