X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=raXarHXXD94vaQ2eA/zw2gXO7ZhJtx0jALaC/xiwrK0=; b=RVxHjEvgeIfZxyk9d2bZfmoYdvJ2OshyTVt/ALxwh5pc4unJ7AB8dDqhFtiXDonD8g EmeukD4S0hLh99xxgpNbmTvz3J7nYaOt1TTznLIXaztHEu27z5QOAnsLkGO3bx/sTxTH F7iAV/9VD1R0O6LpvVRb4EFEU5CmI5UJXC7X78Hbg1Ug8AnghVL0SU1RGvyiUhusRegb C/QQ2xH1n8Rm4tEmvAyLKFTLA1uLrT2NauXA7/J4CodRXWbzh6rKliOd+S4UKxGZnycs 9407mu7kVjBBMrS+eh3xPo9hc4PTFJWgOQcTWs4RwCWe2jrpcBY8VEmv0jK/ZVWc5M3j JxQw== MIME-Version: 1.0 X-Received: by 10.107.27.195 with SMTP id b186mr36865482iob.140.1441131245525; Tue, 01 Sep 2015 11:14:05 -0700 (PDT) In-Reply-To: <83d1y2cf7e.fsf@gnu.org> References: <83d1y2cf7e DOT fsf AT gnu DOT org> Date: Tue, 1 Sep 2015 21:14:05 +0300 Message-ID: Subject: Re: different binary output with 32- and 64-bit hosted compilers From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" To: djgpp AT delorie DOT com Content-Type: text/plain; charset=UTF-8 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 9/1/15, Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com] wrote: >> Date: Tue, 1 Sep 2015 18:20:56 +0300 >> From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" >> >> >> 32-bit (i686-linux fedora-9) and 64-bit (x86_64-linux fedora-20) hosted >> djgpp-targeting compiler generates different output for some sources. >> This happens with djgpp source itself too, and it isn't a nice thing >> and was not an expected thing for me. Did the following with gcc-3.4.6: >> >> Compiled djgpp-cvs with a 32- and 64-bit hosted toolchain (gcc-3.4.6 >> and binutils-2.25.1), then did: >> diff -urp --exclude=*.d --exclude=id_*.o --exclude=stub* \ >> --exclude=*.tex --exclude=*.exe --exclude=djasm.c \ >> 32/src 64/src > 64.diff >> ... which results in this: > > Looks like sign extension and register allocation differences. > > GCC 3.4.6 is quite old, could well be a compiler bug. Maybe it's a > good idea to repeat this experiment with a newer version, like 4.9.x? > Tried with gcc5, not as bad as gcc-3.4.6 but still shows a difference (src/debug/fsdb/expr.o still differs) $ ./i586-pc-msdosdjgpp-gcc -v Using built-in specs. COLLECT_GCC=./i586-pc-msdosdjgpp-gcc COLLECT_LTO_WRAPPER=/home/ozzie/cross-dj5/libexec/gcc/i586-pc-msdosdjgpp/5.2.1/lto-wrapper Target: i586-pc-msdosdjgpp Configured with: ../gcc-5.21.r225981/configure --enable-languages=c,c++ --disable-lto --disable-nls --target=i586-pc-msdosdjgpp --prefix=/home/ozzie/cross-dj5 Thread model: single gcc version 5.2.1 20150718 (GCC) $ diff -urp --exclude=*.d --exclude=*.i --exclude=id_*.o --exclude=stub* --exclude=*.tex --exclude=*.exe --exclude=djasm.c 32/src 64/src > 64y.diff Binary files 32/src/debug/fsdb/expr.o and 64/src/debug/fsdb/expr.o differ diff -urp '--exclude=*.d' '--exclude=*.i' '--exclude=id_*.o' '--exclude=stub*' '--exclude=*.tex' '--exclude=*.exe' '--exclude=djasm.c' 32/src/libc/ansi/stdio/doprnt.s 64/src/libc/ansi/stdio/doprnt.s --- 32/src/libc/ansi/stdio/doprnt.s 2015-09-01 20:57:08.000000000 +0300 +++ 64/src/libc/ansi/stdio/doprnt.s 2015-09-01 21:06:18.258481451 +0300 @@ -4788,85 +4788,85 @@ _NAN_REP.3610: .ascii "NAN\0" .p2align 4 _powtenneg: - .long -858993459 - .long -858993460 + .long 3435973837 + .long 3435973836 .long 16379 .long 1889785610 - .long -1546188227 + .long 2748779069 .long 16376 - .long -501652180 - .long -776530088 + .long 3793315116 + .long 3518437208 .long 16369 - .long -2073964803 - .long -1412663535 + .long 2221002493 + .long 2882303761 .long 16356 - .long -1001528997 - .long -426404674 + .long 3293438299 + .long 3868562622 .long 16329 .long 1161401530 - .long -810475859 + .long 3484491437 .long 16276 - .long -1522931291 - .long -1468011993 + .long 2772036005 + .long 2826955303 .long 16170 .long 1690100897 - .long -573553028 + .long 3721414268 .long 15957 .long 1668946234 - .long -1070513371 + .long 3224453925 .long 15532 - .long -618409444 - .long -1874203086 + .long 3676557852 + .long 2420764210 .long 14682 - .long -631783234 - .long -1566145883 + .long 3663184062 + .long 2728821413 .long 12981 .long 875965924 - .long -827436209 + .long 3467531087 .long 9579 - .long -758210594 - .long -1495464760 + .long 3536756702 + .long 2799502536 .long 2776 .p2align 4 _powten: .long 0 - .long -1610612736 + .long 2684354560 .long 16386 .long 0 - .long -939524096 + .long 3355443200 .long 16389 .long 0 - .long -1673527296 + .long 2621440000 .long 16396 .long 0 - .long -1094967296 + .long 3200000000 .long 16409 .long 67108864 - .long -1910781505 + .long 2384185791 .long 16436 .long 728806814 - .long -1647989336 + .long 2646977960 .long 16489 - .long -3168555 - .long -1032315063 + .long 4291798741 + .long 3262652233 .long 16595 - .long -2132177696 - .long -1816508471 + .long 2162789600 + .long 2478458825 .long 16808 - .long -1644568946 - .long -1434522629 + .long 2650398350 + .long 2860444667 .long 17233 - .long -1508994617 - .long -484859730 + .long 2785972679 + .long 3810107566 .long 18083 - .long -2123035625 - .long -914983546 + .long 2171931671 + .long 3379983750 .long 19784 - .long -985834011 - .long -1635042467 + .long 3309133285 + .long 2659924829 .long 23186 - .long -1977575525 - .long -1000320510 + .long 2317391771 + .long 3294646786 .long 29989 .p2align 4 _UPPER_DIGITS: @@ -4896,13 +4896,13 @@ LC5: .long 1082130432 .p2align 4 LC8: - .long -1977575525 - .long -1000320510 + .long 2317391771 + .long 3294646786 .long 29989 .p2align 4 LC10: - .long -758210594 - .long -1495464760 + .long 3536756702 + .long 2799502536 .long 2776 .p2align 2 LC11: @@ -4912,6 +4912,6 @@ LC12: .long 520093696 .p2align 3 LC13: - .long -350469331 + .long 3944497965 .long 1058682594 .ident "GCC: (GNU) 5.2.1 20150718"