[Bug c++/92666] [10 Regression] bogus -Wunused-but-set-variable in gcov.c with -Wno-restrict

2019-12-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92666

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Assignee|msebor at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
Fixed (although the wrong-code fix needs to be backported).

[Bug c++/92666] [10 Regression] bogus -Wunused-but-set-variable in gcov.c with -Wno-restrict

2019-12-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92666

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Fri Dec 20 23:16:58 2019
New Revision: 279681

URL: https://gcc.gnu.org/viewcvs?rev=279681&root=gcc&view=rev
Log:
PR c++/92666
* call.c (convert_arg_to_ellipsis): For floating point or
decltype(nullptr) arguments call mark_rvalue_use.

* g++.dg/warn/Wunused-var-36.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/warn/Wunused-var-36.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/92666] [10 Regression] bogus -Wunused-but-set-variable in gcov.c with -Wno-restrict

2019-12-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92666

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Created attachment 47521
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47521&action=edit
gcc10-pr92666.patch

Untested fix.  Code inspection revealed a wrong-code bug too.

[Bug c++/92666] [10 Regression] bogus -Wunused-but-set-variable in gcov.c with -Wno-restrict

2019-11-25 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92666

--- Comment #2 from Martin Sebor  ---
The check_function_restrict() function is called to do the -Wrestrict checking.
 It's called conditionally, from check_function_arguments(), when warn_restrict
is nonzero.  When called, the function calls fold_for_warn() for all arguments
of the functions it checks for aliasing violations.  fold_for_warn() ends up
calling mark_rvalue_use() which ultimately calls mark_exp_read() which sets
DECL_READ_P (exp) = 1 for VAR_DECL and PARM_DECL.  None of this happens when
-Wno-restrict is set.

[Bug c++/92666] [10 Regression] bogus -Wunused-but-set-variable in gcov.c with -Wno-restrict

2019-11-25 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92666

Martin Sebor  changed:

   What|Removed |Added

Summary|bogus   |[10 Regression] bogus
   |-Wunused-but-set-variable   |-Wunused-but-set-variable
   |in gcov.c with  |in gcov.c with
   |-Wno-restrict   |-Wno-restrict

--- Comment #1 from Martin Sebor  ---
I thought the problem was introduced with -Wrestrict but it looks like the
false positive is actually a regression caused by r276059:

r276059 | jason | 2019-09-23 13:48:00 -0400 (Mon, 23 Sep 2019) | 10 lines

PR c++/91809 - bit-field and ellipsis.

decay_conversion converts a bit-field access to its declared type, which
isn't what we want here; it even has a comment that the caller is expected
to have already used default_conversion to perform integral promotion.  This
function handles arithmetic promotion differently, but we still don't want
to call decay_conversion before that happens.

* call.c (convert_arg_to_ellipsis): Don't call decay_conversion for
arithmetic arguments.