From d80d3f36d29a12e330e97c81528942fe4f99b1a2 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 2 Mar 2008 10:22:25 +0000 Subject: [PATCH] * 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: trunk@10421 - --- .gitattributes | 1 + compiler/ninl.pas | 4 +++- tests/webtbs/tw10920.pp | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw10920.pp diff --git a/.gitattributes b/.gitattributes index 28cdc031e4..8e17fddcba 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8004,6 +8004,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/tw1096.pp svneol=native#text/plain tests/webtbs/tw1097.pp svneol=native#text/plain tests/webtbs/tw1103.pp svneol=native#text/plain diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 769d2db7de..0c7c449657 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -604,7 +604,9 @@ implementation fracpara.right := ccallparanode.create( cordconstnode.create(ord(tfloatdef(para.left.resultdef).floattype), s32inttype,true),nil); - end; + end + else + fracpara.right:=nil; end; if para.left.resultdef.typ=enumdef then begin diff --git a/tests/webtbs/tw10920.pp b/tests/webtbs/tw10920.pp new file mode 100644 index 0000000000..91895fc835 --- /dev/null +++ b/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. +