[fpc-pascal] Confusing crash in System.WaitFree

2019-12-02 Thread Ryan Joseph via fpc-pascal
I have a crash that I'm not able to replicate in a simple program and appears 
to be related to threading. All I have to go on is this back trace but it 
doesn't give any context into the calling code, just that it's in the FPC 
system unit. Does anyone have any idea what this may be related to so I could 
better track it down? I'm using POSIX threads and I wonder if I'm omitting 
something required for the FPC RTL.

Process 13929 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=EXC_I386_GPFLT)
frame #0: 0x000100020e07 Syndicate`SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR 
+ 23
Syndicate`SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR:
->  0x100020e07 <+23>: movq   0xb8(%rdx), %rdx
0x100020e0e <+30>: movq   %rdx, 0x18(%rax)
0x100020e12 <+34>: movq   0x8(%rax), %rdx
0x100020e16 <+38>: movq   %rax, 0xb8(%rdx)
Target 0: (Syndicate) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS 
(code=EXC_I386_GPFLT)
  * frame #0: 0x000100020e07 Syndicate`SYSTEM_$$_WAITFREE_VAR$PMEMCHUNK_VAR 
+ 23
frame #1: 0x000100020efa 
Syndicate`SYSTEM_$$_SYSFREEMEM_VAR$PFREELISTS$PMEMCHUNK_VAR$$QWORD + 42
frame #2: 0x000100020fdd Syndicate`SYSTEM_$$_SYSFREEMEM$POINTER$$QWORD 
+ 109
frame #3: 0x00010001fe6f Syndicate`SYSTEM_$$_FREEMEM$POINTER$$QWORD + 15


Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Two possible generics bugs

2019-12-02 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal  schrieb am
Mo., 2. Dez. 2019, 14:01:

>
>
> > On Nov 30, 2019, at 12:58 PM, Sven Barth via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> >
> > This can't work. ClassType is of type TClass and TClass.Create calls
> TObject.Create, *not* the constructor of your list type, cause the
> constructor chain is not virtual.
>
> Ok, so if the constructor was virtual this would work as expected? I guess
> that make sense.
>

In this specific case: not really. Because TFPSList has a different
constructor signature than TFPGList<>. And even then you'd need to cast
ClassType to a "class of TFPSList" type as TObject.Create is never virtual.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Two possible generics bugs

2019-12-02 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal  schrieb am
So., 1. Dez. 2019, 23:11:

>
>
> > On Nov 30, 2019, at 1:04 PM, Sven Barth via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> >
> > Well, if you want you can find any place where the _SPECIALIZE and
> _GENERIC tokens are used and checked against mode Delphi to check against a
> new modeswitch instead ("GENERICKEYWORDS") which must be enabled by default
> in all modes except the Delphi ones.
>
> So to get Delphi mode style generics in ObjFPC mode you need to disable
> the modeswitch? That's kind of backwards from what mode switches usually
> do but it makes sense. How do you even disable a mode switch?
>

Well, you disable a feature that a mode provides. Some strange there...

And it's simply done as with other switches:

{$modeswitch xyz-}

(I don't know right now whether "off" is supported as well)

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal