This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/84190] New: [7 Regression] double arithmetic on x86 no longer rounds to nearest


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

            Bug ID: 84190
           Summary: [7 Regression] double arithmetic on x86 no longer
                    rounds to nearest
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruno at clisp dot org
  Target Milestone: ---

Created attachment 43331
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43331&action=edit
test program

The attached program foo.c tests whether simple 'double' arithmetic does
round-to-nearest. It uses 'volatile double' types to make sure that on x86,
x86_64, and ia64, only 53 bits of precision are used instead of the "extended"
doubles that have 64 bits of precision.

With gcc versions 4.2.4 to 6.4.0:
$ gcc -m32 -O -Wall foo.c && ./a.out
1 1 1 1

With gcc versions 7.1.0 to 7.3.0:
$ gcc -m32 -O -Wall foo.c && ./a.out
0 0 0 0

This occurs even with -frounding-math:
$ gcc -m32 -O -frounding-math -Wall foo.c && ./a.out
0 0 0 0

It does not occur when inlining is disabled:
$ gcc -m32 -O -fno-inline -Wall foo.c && ./a.out
1 1 1 1

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]