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

            Bug ID: 87447
           Summary: Missing -Wconversion warning in implicit conversion of
                    unsigned long long to double
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net
  Target Milestone: ---

With -Wconversion, gcc does not warn on the following program, at least on
x86_64.

int foo (double x)
{
  return x == (1ULL << 63) + 1;
}

Here, (1ULL << 63) + 1 is implicitly converted to double, thus with a change of
value (since double has only a 53-bit significand and (1ULL << 63) + 1 needs 64
bits). Therefore, a -Wconversion warning is expected.

Tested with:

gcc (Debian 20180822-1) 9.0.0 20180822 (experimental) [trunk revision 263760]

Reply via email to