Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED!nerds-end From: "Nils M Holm" Newsgroups: comp.compilers Subject: Tripe test failure update Date: Sun, 4 May 2014 10:53:29 +0200 Organization: Compilers Central Lines: 61 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-05-008@comp.compilers> References: <14-05-003@comp.compilers> <14-05-004@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: miucha.iecc.com 1399231968 17608 2001:470:1f07:1126:0:676f:7373:6970 (4 May 2014 19:32:48 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sun, 4 May 2014 19:32:48 +0000 (UTC) Keywords: debug, comment Posted-Date: 04 May 2014 15:32:48 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1233 I am currently running the following procedure to find out at which point the triple test of my SubC compiler fails. This is what happens: The stage-0 (third-party-compiled) scc0 is used to generate a stage-1 scc1. Then scc1 is used to generate the stage-2 compiler scc2. Then scc1 compiles itself to 1) assembly 2) a binary. The same is done with scc2. The assembly output of scc1 and scc2 is identical, the binaries are not. *Both* compilers seem to work perfectly fine. The assembler and linker of the Linux system are used to generate binaries from the assembly output. Adding a stage-3 compiler (compiled with scc2) and comparing against scc2 does not change anything: same assembly, different executables. The test as described above works (identical binaries) on FreeBSD/386, FreeBSD/x86-64, FreeBSD/ARM, NetBSD-x86-64, DOS-8086, and others. It sometimes fails (maybe depending on version?) on Linux-x86-64. (OpenBSD/386 was a false negative.) Differences in the file are literally all over the place. A diff on the hexdumps reports multiple thousand differences). All differences I have found so far are related to addresses, like in the following disassembly snippet: SCC 00000353 74 02 jz 0x00000357 00000355 EB 16 ljmp 0x0000036D 00000357 E8 AD F6 00 00 lcall 0x0000FA09 ***** 0000035C 48 dec %eax 0000035D 89 04 25 38 96 61 00 movl %eax, 0x619638(,1) ------------------------------------------------------------------ SCC1 00000353 74 02 jz 0x00000357 00000355 EB 16 ljmp 0x0000036D 00000357 E8 47 F6 00 00 lcall 0x0000F9A3 ***** 0000035C 48 dec %eax 0000035D 89 04 25 38 96 61 00 movl %eax, 0x619638(,1) I would say that the cause for the difference is in the assembler or linker, but I would like to understand what is going on here. John wrote: [Are the stage-0 and stage-1 assembly sources the same? The first thing that occurs to me is that the code is laid out differently so the variable-length branch logic has long and short instructions in different places. -John] Yes, the stages 0 and 1 generate identical assembly output, so any change in the layout would have to happen in later phases (i.e. assembly and linking). How can that happen? -- Nils M Holm < n m h @ t 3 x . o r g > www.t3x.org [When you compared the individual object files that the assembler genereated, what did you find? -John]