View Issue Details

IDProjectCategoryView StatusLast Update
0038732FPCCompilerpublic2021-04-10 16:44
Reportertomitomy Assigned ToMarco van de Voort  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionduplicate 
PlatformLinuxOSArch Linux 
Product Version3.2.0 
Summary0038732: The 'for in' statement lost characters
DescriptionThe following code can show the bug.
------------------------------
program Project1;

// Arch Linux, Lazarus 2.0.12, FPC 3.2.0

{$mode objfpc}{$H+}

var
  S: String;
begin
  for S in ['1234567', '12345678', '123456', '12345678'] do begin
    WriteLn(S); // Result: 1234567 1234567 123456 1234567 (missing character 8)
  end;

  for S in ['12345678', '12345678', '12345678', '12345678'] do begin
    WriteLn(S); // Result: 12345678 12345678 12345678 12345678 (all is right)
  end;
end.
------------------------------

Forum: https://forum.lazarus.freepascal.org/index.php/topic,54050.0.html
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Relationships

duplicate of 0032034 new Wrong code generated for literal array of string in for-in loop 

Activities

Bart Broersma

2021-04-09 20:21

reporter   ~0130208

In the loop fpc_chararray_to_ansistr is called with the length of the first occuring item in the array.
(trunk also)

Bart Broersma

2021-04-10 16:17

reporter   ~0130243

Can some devel resolve this one as duplicate then?

Issue History

Date Modified Username Field Change
2021-04-09 01:17 tomitomy New Issue
2021-04-09 20:21 Bart Broersma Note Added: 0130208
2021-04-10 15:42 Marco van de Voort Relationship added duplicate of 0032034
2021-04-10 16:17 Bart Broersma Note Added: 0130243
2021-04-10 16:44 Marco van de Voort Assigned To => Marco van de Voort
2021-04-10 16:44 Marco van de Voort Status new => resolved
2021-04-10 16:44 Marco van de Voort Resolution open => duplicate
2021-04-10 16:44 Marco van de Voort FPCTarget => -