[PATCH] Do not use DW_OP_not for TRUTH_NOT_EXPR in conditional expressions

Richard Biener richard.guenther@gmail.com
Fri May 13 08:25:02 GMT 2022


On Fri, May 13, 2022 at 10:21 AM Eric Botcazou via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> DW_OP_not is a bitwise, not a logical NOT, so it computes the wrong result in
> a DWARF conditional expression.
>
> Tested (GCC + GDB° on x86-64/Linux, OK for the mainline?

But this doesn't fix

    case TRUTH_NOT_EXPR:
    case BIT_NOT_EXPR:
      op = DW_OP_not;
      goto do_unop;

I also wonder where we get the TRUTH_NOT_EXPR to expand from?  I suspect
some non-gimplified global tree?

Thanks,
Richard.

>
> 2022-05-13  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * dwarf2out.c (loc_list_from_tree_1) <COND_EXPR>: Swap the operands
>         if the condition is a TRUTH_NOT_EXPR.
>
> --
> Eric Botcazou


More information about the Gcc-patches mailing list