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

            Bug ID: 101090
           Summary: incorrect -Wunused-value warning on remquo with
                    constant values
           Product: gcc
           Version: 9.1.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: ---

When remquo is used with constant values, GCC emits the following warning:
warning: right-hand operand of comma expression has no effect [-Wunused-value]

According to the following testcase compiled with the "-Wunused-value -c"
options, the warning is obtained only for f2, i.e. is does not occur when the
function is not called remquo or when non-constant values are used.

double r (double, double, int *);
double remquo (double, double, int *);

int f1 (void)
{
  int quo;
  r (1.0, 3.0, &quo);
  return quo;
}

int f2 (void)
{
  int quo;
  remquo (1.0, 3.0, &quo);
  return quo;
}

int f3 (double x, double y)
{
  int quo;
  remquo (x, y, &quo);
  return quo;
}

Testcase also available on https://godbolt.org/z/Px44sxn4h for testing, where I
can see that this bug was introduced in GCC 9.1.0 and is still present in the
trunk.
  • [Bug c/101090] New: incorrect -... vincent-gcc at vinc17 dot net via Gcc-bugs

Reply via email to