diff --git a/compiler/nflw.pas b/compiler/nflw.pas index 1ee8a8c0d5..8f48dadaab 100644 --- a/compiler/nflw.pas +++ b/compiler/nflw.pas @@ -586,8 +586,8 @@ implementation addstatement(loopbodystatement,hloopbody); forloopnode:=cfornode.create(ctemprefnode.create(loopvar), - genintconstnode(1), - cinlinenode.create(in_length_x,false,ctemprefnode.create(stringvar)), + cinlinenode.createintern(in_low_x,false,ctemprefnode.create(stringvar)), + cinlinenode.create(in_high_x,false,ctemprefnode.create(stringvar)), loopbody, false); diff --git a/tests/webtbs/tw40500.pp b/tests/webtbs/tw40500.pp new file mode 100644 index 0000000000..9a84d95b2a --- /dev/null +++ b/tests/webtbs/tw40500.pp @@ -0,0 +1,19 @@ +program tw40500; + +{$mode objfpc} {$h+} {$coperators+} {$zerobasedstrings+} +uses + SysUtils; + +var + s: string; + c: char; + +begin + s := ''; + for c in string('share this to instantly die') do + if (c >= #32) and (c <= #127) then s += c else s += '#' + IntToStr(ord(c)); + writeln(s); + if s <> 'share this to instantly die' then + Halt(1); +end. +