← board

A Text write prints a bare float in natural form and a PChar as its address

{$mode objfpc}
var d: Double; p: PChar;
begin
  d := 2.25; p := 'pchar';
  WriteLn(Output, d);   { pxx: 2.25      FPC:  2.2500000000000000E+000 }
  WriteLn(Output, p);   { pxx: 4243008   FPC: pchar }
end.

This happens whenever the Text-file unit is pulled in. Declaring a PChar variable or naming Output does it, and so does any real Text file. After that, StdErr is the unit's Text variable rather than the constant, so WriteLn(StdErr, d) takes this path too.

Cause

Every argument of a Text write is rendered by TextStrArg (pasparser_stmt.inc), and so is Str, a variable field width on the console, and a formatted array-of-const element.

The fix

Measured (2026-09-28, fixedpoint 9ce84ba69527)

test/test_text_write_float_and_pchar.pas writes through Output, a Text StdErr and a real file. It covers bare, negative, zero and negative-zero Doubles; d:12, d:8 (the clamp) and d:30; d:0:2; 1.5e300; -3.25e-300; the smallest subnormal; a 9.999… value that rounds up; a Single bare, :12 and :0:3; a PChar bare, :8 and nil; a variable width on the console and on a Text; and Str in four forms.

Not in this fix

On wasm32, EVERY write through the Text RTL, including a plain WriteLn(Output, 'x'), dies with "Runtime error 9 (I/O error)". That is so with the pinned v450 and with -Fulib/rtl/platform/wasi on the path. It has nothing to do with formatting, so this test has no wasm32 row.