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

            Bug ID: 116581
           Summary: incorrect -Wfloat-conversion warnings for int to
                    _Decimal64
           Product: gcc
           Version: 15.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: ---

GCC emits incorrect -Wfloat-conversion warnings for int to _Decimal64 (this
makes the configure script of GNU MPFR fail when using
-Werror=float-conversion):

qaa:~> cat tst.c
_Decimal64 f(void)
{
  volatile _Decimal64 x = 1;
  _Decimal64 y = 1;
  return x + y;
}

qaa:~> gcc-snapshot -Wfloat-conversion -c tst.c
tst.c: In function 'f':
tst.c:3:27: warning: conversion from 'int' to '_Decimal64' changes value from
'1' to '1' [-Wfloat-conversion]
    3 |   volatile _Decimal64 x = 1;
      |                           ^
tst.c:4:18: warning: conversion from 'int' to '_Decimal64' changes value from
'1' to '1dd' [-Wfloat-conversion]
    4 |   _Decimal64 y = 1;
      |                  ^

Obviously, the value doesn't change. There is also an inconsistency in the
messages: why "to '1'" in the volatile case but "to '1dd'" in the other case?

Note: to get correct output with coloring, do not use a 80-column terminal due
to PR90411.

Reply via email to