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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2017-03-16
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
After some grepping I found the comment you are referring to in gcc/expr.c.  It
sounds to me as though you are suggesting that the whole if statement below is
dead and should be removed.  Some light testing seems to confirm that removing
it has no effect on the C test suite.  The comment that starts with ??? below
the part you quoted seems to imply it's intentional, so I'm not sure what to
make of this report.

Andrew, before I close this bug, would you like to shed some light on what you
had in mind here?  What sort of a resolution are you looking for?

rtx
expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
                    enum expand_modifier modifier, rtx *alt_rtl,
                    bool inner_reference_p)
{
  ...
    case MODIFY_EXPR:
      {
        tree lhs = treeop0;
        tree rhs = treeop1;
        gcc_assert (ignore);

        /* Check for |= or &= of a bitfield of size one into another bitfield
           of size 1.  In this case, (unless we need the result of the
           assignment) we can do this more efficiently with a
           test followed by an assignment, if necessary.

           ??? At this point, we can't get a BIT_FIELD_REF here.  But if
           things change so we do, this code should be enhanced to
           support it.  */
        if (TREE_CODE (lhs) == COMPONENT_REF
            && (TREE_CODE (rhs) == BIT_IOR_EXPR
                || TREE_CODE (rhs) == BIT_AND_EXPR)
            && TREE_OPERAND (rhs, 0) == lhs
            && TREE_CODE (TREE_OPERAND (rhs, 1)) == COMPONENT_REF
            && integer_onep (DECL_SIZE (TREE_OPERAND (lhs, 1)))
            && integer_onep (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1),
1))))
          {
            rtx_code_label *label = gen_label_rtx ();
            int value = TREE_CODE (rhs) == BIT_IOR_EXPR;
            do_jump (TREE_OPERAND (rhs, 1),
                     value ? label : 0,
                     value ? 0 : label, -1);
            expand_assignment (lhs, build_int_cst (TREE_TYPE (rhs), value),
                               false);
            do_pending_stack_adjust ();
            emit_label (label);
            return const0_rtx;
          }

        expand_assignment (lhs, rhs, false);
        return const0_rtx;
      }

Reply via email to