Sign in Join

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

Mailing lists / fpc-devel / 2005-09

Free Pascal Bug 4387 ( Daten.Write('BRTF',4); writes only the pointer to the string, not the string itself. )

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Benjamin Rosseaux

Helllo,

http://www.freepascal.org/bugs/showrec.php3?ID=4387

why is this not an (compiler codegen compatibility) bug?

Daten('BRTF',4) should work like in Delphi (with {$MODE DLEPHI}), with the Delphi compiler Daten('BRTF',4) writes 'BRTF' and not the pointer to the string. Try it yourself!

My opinion you should fix this "bug" to keep the Delphi Mode still more compatible with Delphi And set "not an bug" back to "Unfixed" :)

Benjamin Rosseaux

Show quoted text 145 lines
The entry concerning the bug you reported (bug 4387) has been modified: (View this bug at http://www.freepascal.org/bugs/showrec.php3?ID=4387 ) Bug ID : 4387 Title : Daten.Write('BRTF',4); writes only the pointer to the string, not the string itself. Name : Benjamin Rosseaux Email : Category : Compiler Bug type : Error FPC version : 2.0.0 OS : All Date added : 2005-09-27 Status : Not a bug Date fixed : Fixer : Peter Fix version : Description: The following code does not write the 'BRTF' string correctly, but instead the pointer to the string: Folgender Code schreibt den 'BRTF' String nicht korrekt, sondern statt 'BRTF' den Zeiger zur Zeichenkette: # Register %eax,%edx released # [13906] Daten.Write('BRTF',4); movl $4,%ecx # Register %eax allocated movl $_$ENGINETRACK$_L31021,%eax # Register %ebx allocated movl -4(%ebp),%ebx # Register %edx allocated movl (%ebx),%edx # Register %esi allocated movl 92(%edx),%esi movl %eax,%edx movl %ebx,%eax call *%esi .section .data .balign 4 .globl _$ENGINETRACK$_L31019 _$ENGINETRACK$_L31019: .globl _$ENGINETRACK$_L31021 _$ENGINETRACK$_L31021: .long _$ENGINETRACK$_L31020 .long -1,4 .globl _$ENGINETRACK$_L31020 _$ENGINETRACK$_L31020: .ascii "BRTF\000" ----- The following code writes the 'BRTF' correct: Folgender Code schreibt den 'BRTF' String korrekt: # Register %eax,%edx released # [13905] Daten.Write(Sign,4); movl $4,%ecx # Register %eax allocated movl $TC_ENGINETRACK_TENGINETRACK_$_SPEICHEREBRT$TENGINESTREAM$$BOOLEAN_SIGN,%eax # Register %ebx allocated movl -4(%ebp),%ebx # Register %edx allocated movl (%ebx),%edx # Register %esi allocated movl 92(%edx),%esi movl %eax,%edx movl %ebx,%eax call *%esi .section .data .balign 4 # [13897] CONST Sign:ARRAY[1..4] OF CHAR='BRTF'; TC_ENGINETRACK_TENGINETRACK_$_SPEICHEREBRT$TENGINESTREAM$$BOOLEAN_SIGN: .byte 66,82,84,70 ----- Write is/Write Ist: FUNCTION TEngineStream.Write(CONST Buf;Count:INTEGER):INTEGER; Comment : The string is an ansistring which is an pointer that points to some memory location where the data is stored. The typed const is directly the address of the data. Program:

Reply by email

Benjamin Rosseaux

Hello,

http://www.freepascal.org/bugs/showrec.php3?ID=4387

why is this not an (compiler codegen compatibility) bug?

Daten('BRTF',4) should work like in Delphi (with {$MODE DLEPHI}), with the Delphi compiler Daten('BRTF',4) writes 'BRTF' and not the pointer to the string. Try it yourself!

Delphi translates it to an const char array without a length byte on the beginning. And FreePascal not, and this is the bug.

My opinion you should fix this "bug" to keep the Delphi Mode still more compatible with Delphi And set "not an bug" back to "Unfixed" :)

And I've reposted the bug to
http://www.freepascal.org/bugs/showrec.php3?ID=4390

Benjamin Rosseaux

Show quoted text 145 lines
The entry concerning the bug you reported (bug 4387) has been modified: (View this bug at http://www.freepascal.org/bugs/showrec.php3?ID=4387 ) Bug ID : 4387 Title : Daten.Write('BRTF',4); writes only the pointer to the string, not the string itself. Name : Benjamin Rosseaux Email : Category : Compiler Bug type : Error FPC version : 2.0.0 OS : All Date added : 2005-09-27 Status : Not a bug Date fixed : Fixer : Peter Fix version : Description: The following code does not write the 'BRTF' string correctly, but instead the pointer to the string: Folgender Code schreibt den 'BRTF' String nicht korrekt, sondern statt 'BRTF' den Zeiger zur Zeichenkette: # Register %eax,%edx released # [13906] Daten.Write('BRTF',4); movl $4,%ecx # Register %eax allocated movl $_$ENGINETRACK$_L31021,%eax # Register %ebx allocated movl -4(%ebp),%ebx # Register %edx allocated movl (%ebx),%edx # Register %esi allocated movl 92(%edx),%esi movl %eax,%edx movl %ebx,%eax call *%esi .section .data .balign 4 .globl _$ENGINETRACK$_L31019 _$ENGINETRACK$_L31019: .globl _$ENGINETRACK$_L31021 _$ENGINETRACK$_L31021: .long _$ENGINETRACK$_L31020 .long -1,4 .globl _$ENGINETRACK$_L31020 _$ENGINETRACK$_L31020: .ascii "BRTF\000" ----- The following code writes the 'BRTF' correct: Folgender Code schreibt den 'BRTF' String korrekt: # Register %eax,%edx released # [13905] Daten.Write(Sign,4); movl $4,%ecx # Register %eax allocated movl $TC_ENGINETRACK_TENGINETRACK_$_SPEICHEREBRT$TENGINESTREAM$$BOOLEAN_SIGN,%eax # Register %ebx allocated movl -4(%ebp),%ebx # Register %edx allocated movl (%ebx),%edx # Register %esi allocated movl 92(%edx),%esi movl %eax,%edx movl %ebx,%eax call *%esi .section .data .balign 4 # [13897] CONST Sign:ARRAY[1..4] OF CHAR='BRTF'; TC_ENGINETRACK_TENGINETRACK_$_SPEICHEREBRT$TENGINESTREAM$$BOOLEAN_SIGN: .byte 66,82,84,70 ----- Write is/Write Ist: FUNCTION TEngineStream.Write(CONST Buf;Count:INTEGER):INTEGER; Comment : The string is an ansistring which is an pointer that points to some memory location where the data is stored. The typed const is directly the address of the data. Program:

Reply by email