public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/101090] New: incorrect -Wunused-value warning on remquo with constant values
Date: Wed, 16 Jun 2021 10:27:52 +0000	[thread overview]
Message-ID: <bug-101090-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-06-16 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 10:27 vincent-gcc at vinc17 dot net [this message]
2021-06-16 13:10 ` [Bug c/101090] " rguenth at gcc dot gnu.org
2023-07-18  9:53 ` vincent-gcc at vinc17 dot net
2023-07-18 10:09 ` vincent-gcc at vinc17 dot net
2023-07-18 12:42 ` roger at nextmovesoftware dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101090-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).