[Bug c/101090] incorrect -Wunused-value warning on remquo with constant values

2023-07-18 Thread roger at nextmovesoftware dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101090

Roger Sayle  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 CC||roger at nextmovesoftware dot 
com
 Status|NEW |RESOLVED

--- Comment #4 from Roger Sayle  ---
Many thanks to Vincent for spotting/confirming that his bug report is a
duplicate of PR 106264, which was fixed in GCC 13.

*** This bug has been marked as a duplicate of bug 106264 ***

[Bug c/101090] incorrect -Wunused-value warning on remquo with constant values

2023-07-18 Thread vincent-gcc at vinc17 dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101090

--- Comment #3 from Vincent Lefèvre  ---
(In reply to Vincent Lefèvre from comment #2)
> So, has this bug been fixed (and where)?

This seems to be a particular case of PR106264, which was fixed in commit
r13-1741-g40f6e5912288256ee8ac41474f2dce7b6881c111.

[Bug c/101090] incorrect -Wunused-value warning on remquo with constant values

2023-07-18 Thread vincent-gcc at vinc17 dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101090

--- Comment #2 from Vincent Lefèvre  ---
On Debian, I get a warning from GCC 9 to GCC 12 (Debian 12.3.0-6), but neither
with GCC 13 (Debian 13.1.0-8) nor with 14.0.0 20230612 (Debian 20230613-1).

So, has this bug been fixed (and where)?

[Bug c/101090] incorrect -Wunused-value warning on remquo with constant values

2021-06-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101090

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
   Last reconfirmed||2021-06-16
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #1 from Richard Biener  ---
We warn about

(gdb) p expr
$2 = 
(gdb) p debug_generic_expr (expr)
quo = 0;, 1.0e+0

which is folded from the call via do_mpfr_remquo:

  /* Dereference the quo pointer argument.  */
  arg_quo = build_fold_indirect_ref (arg_quo);
  /* Proceed iff a valid pointer type was passed in.  */
  if (TYPE_MAIN_VARIANT (TREE_TYPE (arg_quo)) == integer_type_node)
{
  /* Set the value. */
  tree result_quo
= fold_build2 (MODIFY_EXPR, TREE_TYPE (arg_quo), arg_quo,
   build_int_cst (TREE_TYPE (arg_quo),
  integer_quo));
  TREE_SIDE_EFFECTS (result_quo) = 1;
  /* Combine the quo assignment with the rem.  */
  result = non_lvalue (fold_build2 (COMPOUND_EXPR, type,
result_quo, result_rem));

but we should probably set TREE_NO_WARNING on the COMPOUND_EXPR.