From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a0c:9ad7:: with SMTP id k23mr743962qvf.52.1616433224227; Mon, 22 Mar 2021 10:13:44 -0700 (PDT) X-Received: by 2002:a25:c943:: with SMTP id z64mr714333ybf.73.1616433224080; Mon, 22 Mar 2021 10:13:44 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 22 Mar 2021 10:13:43 -0700 (PDT) Injection-Info: google-groups.googlegroups.com; posting-host=2601:3c3:401:f550:9ee:b41e:1376:69a6; posting-account=JSxOkAoAAADa00TJoz2WZ_46XrZCdXeS NNTP-Posting-Host: 2601:3c3:401:f550:9ee:b41e:1376:69a6 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: surprise data from Ada.Sequential_IO From: John Perry Injection-Date: Mon, 22 Mar 2021 17:13:44 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61627 List-Id: Hello all I was using gnat 2020 CE on a Linux machine the other day, and wanted to write out data for three different types T1, T2, T3 to a file. I instantiated a Sequential_IO package for each; call them P1, P2, P3. The following worked as expected (sorry for the abbreviations but I think it will be clear): >> P1.Create; P1.Write; P1.Close; P2.Open(Append_File); P2.Write; P2.Close; However, this: >> P3.Open(Append_File); P3.Write; P3.Close; ...wrote a few bytes of junk between T2's data and T3's data. I used a hex editor to check the output file between writes, and there was no junk after P2.Close nor after P3.Open; it always came at the beginning of P3.Write. I reworked the type definitions so that T3's data was included at the end of T2, and in this case P2.Write wrote the data properly, as desired. However, this is not the sort of permanent solution I'd want. Has anyone else encountered this? Could this be due to alignment issues? Is there some way to avoid this without putting the data there? thanks in advance john perry