This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/83419] [8 Regression] -fcompare-debug failure (length)


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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The difference is in shortcut_cond_expr, which does:
3640      bool then_se = then_ && TREE_SIDE_EFFECTS (then_);
3641      bool else_se = else_ && TREE_SIDE_EFFECTS (else_);
Now, else_ in one case is:
0;
which is NOP_EXPR around INTEGER_CST, with !TREE_SIDE_EFFECTS.
With -gstatement-frontiers, else_ is:
# DEBUG BEGIN STMT;
0;
which is a STATEMENT_LIST, containing
# DEBUG BEGIN STMT;
(which doesn't have TREE_SIDE_EFFECTS) and
0; (neither), but the STATEMENT_LIST holding both does have TREE_SIDE_EFFECTS:
as make_node has:
  switch (type)
    {
    case tcc_statement:
      if (code != DEBUG_BEGIN_STMT)
        TREE_SIDE_EFFECTS (t) = 1;
      break;
So, perhaps we need those:
  bool then_se = then_ && TREE_SIDE_EFFECTS (then_);
  bool else_se = else_ && TREE_SIDE_EFFECTS (else_);
          then_se = then_ && TREE_SIDE_EFFECTS (then_);
          else_se = else_ && TREE_SIDE_EFFECTS (else_);
              && !TREE_SIDE_EFFECTS (then_)
              && !generic_expr_could_trap_p (then_)
              && !TREE_SIDE_EFFECTS (else_)
              && !generic_expr_could_trap_p (else_))
replace with a function that will ignore TREE_SIDE_EFFECTS on STATEMENT_LIST
and instead check the statements in it?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]