[Bug c/108068] New: decimal signed zero is not honored

ntysdd at qq dot com gcc-bugzilla@gcc.gnu.org
Mon Dec 12 08:53:22 GMT 2022


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

            Bug ID: 108068
           Summary: decimal signed zero is not honored
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ntysdd at qq dot com
  Target Milestone: ---

This program has different behavior on different optimizing levels.

    #include <stdio.h>
    #include <decimal/decimal>

    int main()
    {
        std::decimal::decimal64 x;
        x = -1;
        while (x != 0)
        {
            x /= 10;
        }
        double d = decimal64_to_double(x);
        printf("%.0f\n", d);
    }


For example, on my current machine (gcc 9.4.0), it gives "-0" on O0, and "0" on
O1, then "-0" again on O2.

I believe it still has similar problems on 12.2


More information about the Gcc-bugs mailing list