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/82068] New: wrong double to uint64_t conversion with -mieee


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

            Bug ID: 82068
           Summary: wrong double to uint64_t conversion with -mieee
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: coypu at sdf dot org
  Target Milestone: ---

background:
gcc 8.0.0 20170827
netbsd-8.99.2/alpha, 21264

the following test case asserts if built with -mieee, but not without:

#include <assert.h>
#include <inttypes.h>
#include <stdint.h>

int
main (void)
{
        long double even = 9223372036854775808.000000; /* 2^63 */
        uint64_t unsigned_even = even;

        assert(unsigned_even % 2 == 0);

        return 0;
}

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