public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106264] New: spurious -Wunused-value on a folded frexp, modf,  and remquo calls with unused result
@ 2022-07-11 21:05 msebor at gcc dot gnu.org
  2022-07-11 21:07 ` [Bug c/106264] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: msebor at gcc dot gnu.org @ 2022-07-11 21:05 UTC (permalink / raw)
  To: gcc-bugs

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);
      |   ^~~~~~~~~~~~~~~~~~~~~

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-18 12:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11 21:05 [Bug c/106264] New: spurious -Wunused-value on a folded frexp, modf, and remquo calls with unused result msebor at gcc dot gnu.org
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

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).