Просмотр исходного кода

Merged revisions 10421 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r10421 | jonas | 2008-03-02 11:22:25 +0100 (Sun, 02 Mar 2008) | 4 lines

* fixed crash when writing a currency value with a specified number
of fractional digits in case it's not the last value of the
write(ln) statement (mantis #10920)

........

git-svn-id: branches/fixes_2_2@10613 -

Jonas Maebe 17 лет назад
Родитель
Сommit
7b67607f85
3 измененных файлов с 22 добавлено и 1 удалено
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/ninl.pas
  3. 18 0
      tests/webtbs/tw10920.pp

+ 1 - 0
.gitattributes

@@ -7909,6 +7909,7 @@ tests/webtbs/tw10890.pp svneol=native#text/plain
 tests/webtbs/tw10897.pp svneol=native#text/plain
 tests/webtbs/tw1090.pp svneol=native#text/plain
 tests/webtbs/tw1092.pp svneol=native#text/plain
+tests/webtbs/tw10920.pp svneol=native#text/plain
 tests/webtbs/tw10927.pp svneol=native#text/plain
 tests/webtbs/tw1096.pp svneol=native#text/plain
 tests/webtbs/tw1097.pp svneol=native#text/plain

+ 3 - 1
compiler/ninl.pas

@@ -810,7 +810,9 @@ implementation
                                 fracpara.right := ccallparanode.create(
                                     cordconstnode.create(ord(tfloatdef(para.left.resultdef).floattype),
                                     s32inttype,true),nil);
-                              end;
+                              end
+                            else
+                              fracpara.right:=nil;
                           end;
                       end;
 

+ 18 - 0
tests/webtbs/tw10920.pp

@@ -0,0 +1,18 @@
+program bug_fmtcurrncy;
+//  If write/writeln parameter list includes any item FOLLOWING a 
+//     currency variable with format specs, the compiler throws
+//     an Access violation exception.
+
+var
+  V: currency;    // currency blows up,  all other real types are Ok
+
+BEGIN
+  V := 34567;
+
+  write( V:0:2, 'x' );   // This form produces the error
+
+  write( V:0:2 );        // This equivalent form compiles Ok
+  writeln( 'x' );
+
+END.
+