public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/105641] New: Floating point constants are 0 in C LTO objects
@ 2022-05-18  7:00 richard at weickelt dot de
  2022-05-18 10:06 ` [Bug lto/105641] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: richard at weickelt dot de @ 2022-05-18  7:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105641

            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 valid.
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=test_float test.o

    test_float ()
    {
      <bb 2> [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=test_float test.o

    test_float ()
    {
      <bb 2> [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:

   
/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/src/gcc/configure
--target=arm-none-eabi
--prefix=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native
--libexecdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/lib
--infodir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/info
--mandir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/man
--htmldir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/html
--pdfdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/pdf
--enable-languages=c,c++ --enable-plugins --disable-decimal-float
--disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath
--disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared
--disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib
--with-headers=yes --with-python-dir=share/gcc-arm-none-eabi
--with-sysroot=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/arm-none-eabi
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--with-gmp=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr
--with-mpfr=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr
--with-mpc=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr
--with-isl=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr
--with-libelf=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-pkgversion='GNU Arm Embedded Toolchain 10.3-2021.10'
--with-multilib-list=rmprofile,aprofile
Thread model: single
Supported LTO compression algorithms: zlib

Configuration on Windows:

/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/src/gcc/configure
--build=x8
6_64-linux-gnu --host=i686-w64-mingw32 --target=arm-none-eabi
--prefix=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipelin
e-260_20210727_1627371386/install-mingw
--libexecdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_162
7371386/install-mingw/lib
--infodir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/install-m
ingw/share/doc/gcc-arm-none-eabi/info
--mandir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_162737138
6/install-mingw/share/doc/gcc-arm-none-eabi/man
--htmldir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_2021072
7_1627371386/install-mingw/share/doc/gcc-arm-none-eabi/html
--pdfdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-
260_20210727_1627371386/install-mingw/share/doc/gcc-arm-none-eabi/pdf
--enable-languages=c,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=yes --with-newlib --with-python-di
r=share/gcc-arm-none-eabi
--with-sysroot=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/inst
all-mingw/arm-none-eabi
--with-libiconv-prefix=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_162737138
6/build-mingw/host-libs/usr
--with-gmp=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/build-
mingw/host-libs/usr
--with-mpfr=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/build-mingw/h
ost-libs/usr
--with-mpc=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/build-mingw/host-libs
/usr
--with-isl=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/build-mingw/host-libs/usr
--w
ith-libelf=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-260_20210727_1627371386/build-mingw/host-libs/usr
--with-h
ost-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm'
--with-pkgversion='GNU Arm Embedded Toolchain 10.3-2021.07' --with-
multilib-list=rmprofile,aprofile
Thread model: single
Supported LTO compression algorithms: zlib

GCC version 10.3.1 20210621

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/105641] Floating point constants are 0 in C LTO objects
  2022-05-18  7:00 [Bug lto/105641] New: Floating point constants are 0 in C LTO objects richard at weickelt dot de
@ 2022-05-18 10:06 ` pinskia at gcc dot gnu.org
  2022-05-18 10:10 ` [Bug lto/105641] Floating point constants are 0 in " richard at weickelt dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-18 10:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105641

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes we don't support still different host compiling lto code.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/105641] Floating point constants are 0 in LTO objects
  2022-05-18  7:00 [Bug lto/105641] New: Floating point constants are 0 in C LTO objects richard at weickelt dot de
  2022-05-18 10:06 ` [Bug lto/105641] " pinskia at gcc dot gnu.org
@ 2022-05-18 10:10 ` richard at weickelt dot de
  2022-05-18 10:43 ` richard at weickelt dot de
  2022-05-18 12:43 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: richard at weickelt dot de @ 2022-05-18 10:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105641

Richard Weickelt <richard at weickelt dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Floating point constants    |Floating point constants
                   |are 0 in C LTO objects      |are 0 in LTO objects

--- Comment #2 from Richard Weickelt <richard at weickelt dot de> ---
g++ is affected as well.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/105641] Floating point constants are 0 in LTO objects
  2022-05-18  7:00 [Bug lto/105641] New: Floating point constants are 0 in C LTO objects richard at weickelt dot de
  2022-05-18 10:06 ` [Bug lto/105641] " pinskia at gcc dot gnu.org
  2022-05-18 10:10 ` [Bug lto/105641] Floating point constants are 0 in " richard at weickelt dot de
@ 2022-05-18 10:43 ` richard at weickelt dot de
  2022-05-18 12:43 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: richard at weickelt dot de @ 2022-05-18 10:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105641

--- Comment #3 from Richard Weickelt <richard at weickelt dot de> ---
Aha, according to bug 41526, GIMPLE bytecode streams are not portable across
different hosts. That's unfortunate.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/105641] Floating point constants are 0 in LTO objects
  2022-05-18  7:00 [Bug lto/105641] New: Floating point constants are 0 in C LTO objects richard at weickelt dot de
                   ` (2 preceding siblings ...)
  2022-05-18 10:43 ` richard at weickelt dot de
@ 2022-05-18 12:43 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-18 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105641

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yes, unfortunate indeed.  But also non-trivial to fix.

*** This bug has been marked as a duplicate of bug 41526 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-18 12:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  7:00 [Bug lto/105641] New: Floating point constants are 0 in C LTO objects richard at weickelt dot de
2022-05-18 10:06 ` [Bug lto/105641] " pinskia at gcc dot gnu.org
2022-05-18 10:10 ` [Bug lto/105641] Floating point constants are 0 in " richard at weickelt dot de
2022-05-18 10:43 ` richard at weickelt dot de
2022-05-18 12:43 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).