Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2015-11

Access violation in fpmake

7 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

MohsenTi

Hi
I checkout fpc trunk and try to build it but fpmake raise access violation exception
how to solve it ?

./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o -Xs -o -O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE
--compiler=/home/mohsen/Applications/Lazarus/fpc-trunk/compiler/ppcx64 -bu -o -XX -o -CX
The installer encountered the following error:
Access violation

Reply by email

Michael Ring
to MohsenTi

Same here when building fpc-arm an a mac with fpc 2.6.4

Von meinem iPad gesendet

Show quoted text 13 lines
Am 15.11.2015 um 17:31 schrieb MohsenTi : Hi I checkout fpc trunk and try to build it but fpmake raise access violation exception how to solve it ? ./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o -Xs -o -O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE --compiler=/home/mohsen/Applications/Lazarus/fpc-trunk/compiler/ppcx64 -bu -o -XX -o -CX The installer encountered the following error: Access violation _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Jonas Maebe
to MohsenTi: Hi I checkout fpc trunk and try to build it but fpmake raise access violation exception…
MohsenTi wrote 11 lines
Hi I checkout fpc trunk and try to build it but fpmake raise access violation exception how to solve it ? ./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o -Xs -o -O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE --compiler=/home/mohsen/Applications/Lazarus/fpc-trunk/compiler/ppcx64 -bu -o -XX -o -CX The installer encountered the following error: Access violation

It's because of r32327. Michael?

Jonas

Reply by email

Michael Van Canneyt
to Jonas Maebe
Jonas Maebe wrote 14 lines
On 15/11/15 17:31, MohsenTi wrote: > Hi > I checkout fpc trunk and try to build it but fpmake raise access > violation exception > how to solve it ? > > ./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o -Xs > -o -O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE > --compiler=/home/mohsen/Applications/Lazarus/fpc-trunk/compiler/ppcx64 > -bu -o -XX -o -CX > The installer encountered the following error: > Access violation It's because of r32327. Michael?

Strange, I created a test before committing, and it ran fine. Well. I reinstated line 1132. But according to logic, that line should not be necessary. Maybe I am not properly seeing a case where it can go wrong.

Michael.

Reply by email

Karoly Balogh (Charlie/SGR
to Michael Van Canneyt

Hi,

Michael Van Canneyt wrote
Strange, I created a test before committing, and it ran fine. Well. I reinstated line 1132. But according to logic, that line should not be necessary. Maybe I am not properly seeing a case where it can go wrong.

Wild try/guess just by looking at the code:

If FList^[Index].FString is not nil (which is true after the System.Move() there), then at the next line at the assignment, there will be an attempt to reduce the reference count of the string before assigning the new one, and then it's a very likely case that the reference count of it will be zero, so the string is freed.

Which means the string at FList^[Index+1] will be invalid, because System.Move() doesn't do anything with the reference counts, so at that point FList^[Index] and FList^[Index+1] are eachothers clones, but the reference count doesn't reflect that.

Therefore that nil (and the pointer cast!) is very much required. The pointer cast is needed, so the string will be handled as pointer, and only the value is erased, but the refrence counts are untouched.

Someone please fix me if I'm wrong. :)

Charlie

Reply by email

Michael Ring
to Michael Van Canneyt: Strange, I created a test before committing, and it ran fine. Well. I reinstated line…

Works again for me, thank you for fixing!

Michael

Michael Van Canneyt wrote 29 lines
On Sun, 15 Nov 2015, Jonas Maebe wrote: > On 15/11/15 17:31, MohsenTi wrote: >> Hi >> I checkout fpc trunk and try to build it but fpmake raise access >> violation exception >> how to solve it ? >> >> ./fpmake compile --localunitdir=.. --os=linux --cpu=x86_64 -o -Ur -o >> -Xs >> -o -O2 -o -n -o -Cg -o -dx86_64 -o -dRELEASE >> --compiler=/home/mohsen/Applications/Lazarus/fpc-trunk/compiler/ppcx64 >> -bu -o -XX -o -CX >> The installer encountered the following error: >> Access violation > > It's because of r32327. Michael? Strange, I created a test before committing, and it ran fine. Well. I reinstated line 1132. But according to logic, that line should not be necessary. Maybe I am not properly seeing a case where it can go wrong. Michael. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

Michael Van Canneyt
to Karoly Balogh (Charlie/SGR: Wild try/guess just by looking at the code: If FList^[Index].FString is not nil (which is…
Karoly Balogh wrote 26 lines
Hi, On Sun, 15 Nov 2015, Michael Van Canneyt wrote: > Strange, I created a test before committing, and it ran fine. Well. I > reinstated line 1132. But according to logic, that line should not be > necessary. Maybe I am not properly seeing a case where it can go wrong. Wild try/guess just by looking at the code: If FList^[Index].FString is not nil (which is true after the System.Move() there), then at the next line at the assignment, there will be an attempt to reduce the reference count of the string before assigning the new one, and then it's a very likely case that the reference count of it will be zero, so the string is freed. Which means the string at FList^[Index+1] will be invalid, because System.Move() doesn't do anything with the reference counts, so at that point FList^[Index] and FList^[Index+1] are eachothers clones, but the reference count doesn't reflect that. Therefore that nil (and the pointer cast!) is very much required. The pointer cast is needed, so the string will be handled as pointer, and only the value is erased, but the refrence counts are untouched. Someone please fix me if I'm wrong. :)

But the fillword should have cleared all allocated memory in SetCapacity ? So how can it be that there is a (valid) index where FList^[Index].FString is not nil ?

Wait, I think I have it.
When a delete is done, a move happens, but the item at Flist[Count] is not cleared.

Probably that is what causes this.

Michael.

Reply by email