public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/106264] New: spurious -Wunused-value on a folded frexp, modf,  and remquo calls with unused result
Date: Mon, 11 Jul 2022 21:05:44 +0000	[thread overview]
Message-ID: <bug-106264-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 106264
           Summary: spurious -Wunused-value on a folded frexp, modf, and
                    remquo calls with unused result
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

In C mode only the following test case triggers the invalid (or at least poorly
worded and so confusing) instances of -Wunused-value.  Each instance goes away
when the call is not folded or when its result is used.  The C++ front end
doesn't warn.

$ cat a.c && gcc -O -Wall -S -Wall a.c
double frexp (double, int*);
double modf (double, double*);
double remquo (double, double, int*);

int f (void)
{
  int y;
  frexp (1.0, &y);
  return y;
}

double g (void)
{
  double y;
  modf (1.0, &y);
  return y;
}

int h (void)
{
  int y;
  remquo (1.0, 1.0, &y);
  return y;
}

a.c: In function ‘f’:
a.c:8:3: warning: right-hand operand of comma expression has no effect
[-Wunused-value]
    8 |   frexp (1.0, &y);
      |   ^~~~~~~~~~~~~~~
a.c: In function ‘g’:
a.c:15:3: warning: right-hand operand of comma expression has no effect
[-Wunused-value]
   15 |   modf (1.0, &y);
      |   ^~~~~~~~~~~~~~
a.c: In function ‘h’:
a.c:22:3: warning: right-hand operand of comma expression has no effect
[-Wunused-value]
   22 |   remquo (1.0, 1.0, &y);
      |   ^~~~~~~~~~~~~~~~~~~~~

             reply	other threads:[~2022-07-11 21:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 21:05 msebor at gcc dot gnu.org [this message]
2022-07-11 21:07 ` [Bug c/106264] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-07-11 21:09 ` pinskia at gcc dot gnu.org
2022-07-11 21:13 ` msebor at gcc dot gnu.org
2022-07-11 21:16 ` pinskia at gcc dot gnu.org
2022-07-12  6:38 ` rguenth at gcc dot gnu.org
2022-07-15  8:34 ` [Bug c/106264] [10/11/12/13 Regression] spurious -Wunused-value on a folded frexp, modf, and remquo calls with unused result since r9-1295-g781ff3d80e88d7d0 marxin at gcc dot gnu.org
2022-07-16 12:59 ` roger at nextmovesoftware dot com
2022-07-19  7:40 ` cvs-commit at gcc dot gnu.org
2022-07-20  6:07 ` roger at nextmovesoftware dot com
2023-07-18 10:07 ` 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-106264-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).