The test program writes 3 values of a discriminated record to a stream ('Output) and then reads them back ('Input). It then uses 'Write and 'Read for a single value.
No problem arises with 32-bit compilations, or with 64-bit compilations with -O0. With -O1 or -O2, the values read back are incorrect (in some cases). Same behaviour reported on Debian: gnat-4.4_4.4.2-5_amd64.deb: -O0 OK -O1 bug -O2 bug gnat-4.4_4.4.2-5_i386.deb: -O0 OK -O1 OK -O2 OK That version of GNAT was taken from the FSF's gcc-4_4-branch on 2009-12-28 so is very recent. The correct output is 1234 'z' 4.32100E-01 4.32100E-01 The incorrect output is 1234 NUL 0.00000E+00 0.00000E+00 -- Summary: Problem reading discriminated values from streams Product: gcc Version: 4.4.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: simon at pushface dot org GCC host triplet: x86_64-apple-darwin10 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42618