public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112367] New: wrong rounding of sum of floating-point constants
@ 2023-11-03 11:09 zimmerma+gcc at loria dot fr
  2023-11-03 11:11 ` [Bug c/112367] " sjames at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2023-11-03 11:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112367
           Summary: wrong rounding of sum of floating-point constants
           Product: gcc
           Version: 6.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zimmerma+gcc at loria dot fr
  Target Milestone: ---

The following code:

#include <stdio.h>
#include <fenv.h>

#pragma STDC FENV_ACCESS ON

int main()
{
  fesetround (FE_UPWARD);
  float x = 0x1.e90026p+4f + 0x1.fp-21;
  printf ("x=%a\n", x);
}

yields on cfarm117 with gcc 6.3.0:

zimmerma@cfarm117:~/core-math$ gcc -frounding-math e.c -lm; ./a.out
x=0x1.e90026p+4

whereas one would expect 0x1.e90028p+4.

I don't have access to an ARM machine with a recent version of gcc.

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

* [Bug c/112367] wrong rounding of sum of floating-point constants
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
@ 2023-11-03 11:11 ` sjames at gcc dot gnu.org
  2023-11-03 11:15 ` zimmerma+gcc at loria dot fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-03 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjames at gcc dot gnu.org

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
Build a newer one on cfarm117?

Also, what CHOST?

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

* [Bug c/112367] wrong rounding of sum of floating-point constants
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
  2023-11-03 11:11 ` [Bug c/112367] " sjames at gcc dot gnu.org
@ 2023-11-03 11:15 ` zimmerma+gcc at loria dot fr
  2023-11-03 11:21 ` sjames at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2023-11-03 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
> Build a newer one on cfarm117?

it would be a waste of time, I guess people having access to an ARM machine
with a recent version of gcc can confirm or say the issue is fixed.

> Also, what CHOST?

sorry I'm not sure to understand. Here is the full gcc -v output:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/6/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1'
--with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-6 --program-prefix=aarch64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-arm64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-arm64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-arm64
--with-arch-directory=aarch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-multiarch --enable-fix-cortex-a53-843419 --enable-checking=release
--build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)

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

* [Bug c/112367] wrong rounding of sum of floating-point constants
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
  2023-11-03 11:11 ` [Bug c/112367] " sjames at gcc dot gnu.org
  2023-11-03 11:15 ` zimmerma+gcc at loria dot fr
@ 2023-11-03 11:21 ` sjames at gcc dot gnu.org
  2023-11-03 11:21 ` sjames at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-03 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Paul Zimmermann from comment #2)
> > Build a newer one on cfarm117?
> 
> it would be a waste of time, I guess people having access to an ARM machine
> with a recent version of gcc can confirm or say the issue is fixed.
> 

I don't think it's a waste of time, as you're often IIRC working on these
tests, so it would be useful to know. But I digress.

I also offer you access to an arm64 machine if you wish to have it.

> > Also, what CHOST?
> 
> sorry I'm not sure to understand. Here is the full gcc -v output:
> 

CHOST tells us ABI so I know what machine to check (also needed in general for
the report). I suppose I really wanted CTARGET.


> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/6/lto-wrapper
> Target: aarch64-linux-gnu

This is what I needed. Thanks.

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

* [Bug c/112367] wrong rounding of sum of floating-point constants
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
                   ` (2 preceding siblings ...)
  2023-11-03 11:21 ` sjames at gcc dot gnu.org
@ 2023-11-03 11:21 ` sjames at gcc dot gnu.org
  2023-11-03 11:40 ` amonakov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-03 11:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
$ gcc /tmp/foo.c -lm -frounding-math -o /tmp/foo

$ /tmp/foo
x=0x1.e90028p+4

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-unknown-linux-gnu/13/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-13.2.1_p20230826/work/gcc-13-20230826/configure
--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu
--prefix=/usr --bindir=/usr/aarch64-unknown-linux-gnu/gcc-bin/13
--includedir=/usr/lib/gcc/aarch64-unknown-linux-gnu/13/include
--datadir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/13
--mandir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/13/man
--infodir=/usr/share/gcc-data/aarch64-unknown-linux-gnu/13/info
--with-gxx-include-dir=/usr/lib/gcc/aarch64-unknown-linux-gnu/13/include/g++-v13
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/aarch64-unknown-linux-gnu/13/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened
13.2.1_p20230826 p7' --with-gcc-major-version-only --enable-libstdcxx-time
--enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-fixed-point --enable-libgomp --disable-libssp --disable-libada
--disable-cet --disable-systemtap --disable-valgrind-annotations
--disable-vtable-verify --disable-libvtv --without-zstd --without-isl
--enable-default-pie --enable-default-ssp --with-build-config=bootstrap-lto
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.1 20230826 (Gentoo Hardened 13.2.1_p20230826 p7)

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

* [Bug c/112367] wrong rounding of sum of floating-point constants
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
                   ` (3 preceding siblings ...)
  2023-11-03 11:21 ` sjames at gcc dot gnu.org
@ 2023-11-03 11:40 ` amonakov at gcc dot gnu.org
  2023-11-04  5:48 ` [Bug middle-end/112367] " pinskia at gcc dot gnu.org
  2023-11-06  8:59 ` [Bug middle-end/112367] wrong rounding of sum of floating-point constants with -frounding-math zimmerma+gcc at loria dot fr
  6 siblings, 0 replies; 8+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-11-03 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
As far as I can tell this was broken for all targets before gcc-12, and fixed
for all targets starting from gcc-12.

Paul, can this bug be closed?

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

* [Bug middle-end/112367] wrong rounding of sum of floating-point constants
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
                   ` (4 preceding siblings ...)
  2023-11-03 11:40 ` amonakov at gcc dot gnu.org
@ 2023-11-04  5:48 ` pinskia at gcc dot gnu.org
  2023-11-06  8:59 ` [Bug middle-end/112367] wrong rounding of sum of floating-point constants with -frounding-math zimmerma+gcc at loria dot fr
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-04  5:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |12.0
          Component|c                           |middle-end
         Resolution|---                         |FIXED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 12 via  r12-4764-ga84b9d5373c7e67fd0ab2a412 (aka PR 57245). Since
this is not a regression it was not backported to earlier versions.


Also GCC 6 is definitely no longer supported and a newer version should be
used/tried before reporting a bug.

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

* [Bug middle-end/112367] wrong rounding of sum of floating-point constants with -frounding-math
  2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
                   ` (5 preceding siblings ...)
  2023-11-04  5:48 ` [Bug middle-end/112367] " pinskia at gcc dot gnu.org
@ 2023-11-06  8:59 ` zimmerma+gcc at loria dot fr
  6 siblings, 0 replies; 8+ messages in thread
From: zimmerma+gcc at loria dot fr @ 2023-11-06  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
thank you all and sorry for the noise

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

end of thread, other threads:[~2023-11-06  8:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03 11:09 [Bug c/112367] New: wrong rounding of sum of floating-point constants zimmerma+gcc at loria dot fr
2023-11-03 11:11 ` [Bug c/112367] " sjames at gcc dot gnu.org
2023-11-03 11:15 ` zimmerma+gcc at loria dot fr
2023-11-03 11:21 ` sjames at gcc dot gnu.org
2023-11-03 11:21 ` sjames at gcc dot gnu.org
2023-11-03 11:40 ` amonakov at gcc dot gnu.org
2023-11-04  5:48 ` [Bug middle-end/112367] " pinskia at gcc dot gnu.org
2023-11-06  8:59 ` [Bug middle-end/112367] wrong rounding of sum of floating-point constants with -frounding-math zimmerma+gcc at loria dot fr

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).