two argument form of copy causes crash
Original Reporter info from Mantis: marco @marcoonthegit
-
Reporter name: Marco van de Voort
Original Reporter info from Mantis: marco @marcoonthegit
- Reporter name: Marco van de Voort
Description:
Delphi seems to have a 2 argument form of the copy() internal function
something:=copy(s,5);
which copies the array starting from element 5 till the end.
Steps to reproduce:
See attached test. Delphi XE output is in comment in test.
Additional information:
Reported on:
http://stackoverflow.com/questions/12542200/function-copy-in-free-pascal/12544614
Compiling the test with up to date FPC 2.7.1 causes an AV:
copy2arg.dpr(11,10) Warning: Function result does not seem to be set
copy2arg.dpr(14,21) Error: Wrong number of parameters specified for call to "$fpc_ansistr_copy"
Fatal: Compilation aborted
An unhandled exception occurred at $0046CE71:
EAccessViolation: Access violation
$0046CE71 TABSTRACTPROCDEF__INIT_PARALOC_INFO, line 3995 of symdef.pas
$0046CF5E TABSTRACTPROCDEF__STACK_TAINTING_PARAMETER, line 4022 of symdef.pas
$004A62AC CHECK_CONTAINS_STACK_TAINTING_CALL, line 1039 of ncal.pas
$0047C313 FOREACHNODESTATIC, line 287 of nutils.pas
$004A62ED TCALLPARANODE__CONTAINS_STACK_TAINTING_CALL, line 1048 of ncal.pas
$004A6311 TCALLPARANODE__INIT_CONTAINS_STACK_TAINTING_CALL_CACHE, line 1054 of ncal.pas
$004AB228 TCALLNODE__ORDER_PARAMETERS, line 3234 of ncal.pas
$004ABA1C TCALLNODE__PASS1_NORMAL, line 3545 of ncal.pas
$004AB892 TCALLNODE__PASS_1, line 3494 of ncal.pas
$00449770 FIRSTPASS, line 184 of pass_1.pas
$00487B81 TBLOCKNODE__PASS_1, line 592 of nbas.pas
$00449770 FIRSTPASS, line 184 of pass_1.pas
$00487B81 TBLOCKNODE__PASS_1, line 592 of nbas.pas
$00449770 FIRSTPASS, line 184 of pass_1.pas
$00449868 DO_FIRSTPASS, line 230 of pass_1.pas
$004F5DBF TCGPROCINFO__GENERATE_CODE, line 1183 of psub.pas
$004F5891 TCGPROCINFO__GENERATE_CODE_TREE, line 1007 of psub.pas
Error: d:\pp11\bin\i386-win32\ppc386.exe returned an error exitcode
D:\testing
The string only code (before adding the dynarray code) caused a
Error: Wrong number of parameters specified for call to "$fpc_ansistr_copy"
Mantis conversion info:
- Mantis ID: 22964
- Fixed in version: 3.0.0
- Fixed in revision: 22575 (#9a5e6444)