From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3E653858C51; Wed, 18 May 2022 07:00:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3E653858C51 From: "richard at weickelt dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/105641] New: Floating point constants are 0 in C LTO objects Date: Wed, 18 May 2022 07:00:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 10.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: richard at weickelt dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2022 07:00:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105641 Bug ID: 105641 Summary: Floating point constants are 0 in C LTO objects Product: gcc Version: 10.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: richard at weickelt dot de CC: marxin at gcc dot gnu.org Target Milestone: --- When compiling C code with arm-none-eabi-gcc and -flto on a Linux host and linking the final binary on a Windows host with exactly the same toolchain version, all float constants are 0, whereas the rest of the code seems vali= d. Code compiled with g++ is not affected by this, only gcc. Example code: float test_float() { return 47.0; } Compilation: arm-none-eabi-gcc -Os -flto -c test.c -o test.o Dumping GIMPLE code on the same Linux host shows: arm-none-eabi-lto-dump -dump-body=3Dtest_float test.o test_float () { [local count: 1073741824]: return 4.7e+1; } Dumping GIMPLE code on a Windows host with the same toolchain release: arm-none-eabi-lto-dump.exe -dump-body=3Dtest_float test.o test_float () { [local count: 1073741824]: return 0.0e+0; } The GIMPLE code matches what I observe in the final binary. I expect LTO objects to be compatible across different host operating systems as long as= the toolchain version matches. The fact that it works just fine with g++ and/or integer values, indicates a bug somewhere in the toolchain. GCC configuration on Linux: =20=20=20 /mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_202110= 18_1634516203/src/gcc/configure --target=3Darm-none-eabi --prefix=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline= -338_20211018_1634516203/install-native --libexecdir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipe= line-338_20211018_1634516203/install-native/lib --infodir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipelin= e-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/info --mandir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline= -338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipelin= e-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline= -338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=3Dc,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadma= th --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=3Dyes --with-python-dir=3Dshare/gcc-arm-none-eabi --with-sysroot=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pi= peline-338_20211018_1634516203/install-native/arm-none-eabi --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --with-gmp=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-338_20211018_1634516203/build-native/host-libs/usr --with-mpfr=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipel= ine-338_20211018_1634516203/build-native/host-libs/usr --with-mpc=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-338_20211018_1634516203/build-native/host-libs/usr --with-isl=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-338_20211018_1634516203/build-native/host-libs/usr --with-libelf=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pip= eline-338_20211018_1634516203/build-native/host-libs/usr --with-host-libstdcxx=3D'-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion=3D'GNU Arm Embedded Toolchain 10.3-2021.10' --with-multilib-list=3Drmprofile,aprofile Thread model: single Supported LTO compression algorithms: zlib Configuration on Windows: /mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_202107= 27_1627371386/src/gcc/configure --build=3Dx8 6_64-linux-gnu --host=3Di686-w64-mingw32 --target=3Darm-none-eabi --prefix=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipelin e-260_20210727_1627371386/install-mingw --libexecdir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipe= line-260_20210727_162 7371386/install-mingw/lib --infodir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipelin= e-260_20210727_1627371386/install-m ingw/share/doc/gcc-arm-none-eabi/info --mandir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline= -260_20210727_162737138 6/install-mingw/share/doc/gcc-arm-none-eabi/man --htmldir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipelin= e-260_2021072 7_1627371386/install-mingw/share/doc/gcc-arm-none-eabi/html --pdfdir=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline- 260_20210727_1627371386/install-mingw/share/doc/gcc-arm-none-eabi/pdf --enable-languages=3Dc,c++ --enable-mingw-wildcard --disable-decim al-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disa ble-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-headers=3Dyes --with-newlib --with-python-di r=3Dshare/gcc-arm-none-eabi --with-sysroot=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pi= peline-260_20210727_1627371386/inst all-mingw/arm-none-eabi --with-libiconv-prefix=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-G= CC-10-pipeline-260_20210727_162737138 6/build-mingw/host-libs/usr --with-gmp=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-260_20210727_1627371386/build- mingw/host-libs/usr --with-mpfr=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipel= ine-260_20210727_1627371386/build-mingw/h ost-libs/usr --with-mpc=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-260_20210727_1627371386/build-mingw/host-libs /usr --with-isl=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-260_20210727_1627371386/build-mingw/host-libs/usr --w ith-libelf=3D/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeli= ne-260_20210727_1627371386/build-mingw/host-libs/usr --with-h ost-libstdcxx=3D'-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion=3D'GNU Arm Embedded Toolchain 10.3-2021.07' --with- multilib-list=3Drmprofile,aprofile Thread model: single Supported LTO compression algorithms: zlib GCC version 10.3.1 20210621=