On Mon, May 16, 2022 at 9:06 AM Eric Botcazou <botca...@adacore.com> wrote: > > > But this doesn't fix > > > > case TRUTH_NOT_EXPR: > > case BIT_NOT_EXPR: > > op = DW_OP_not; > > goto do_unop; > > Revised patch attached, using Jakub's suggestion. The original (buggy) DWARF > procedure for the Ada testcase I previously posted is: > > .uleb128 0x8 # (DIE (0x5b) DW_TAG_dwarf_procedure) > .uleb128 0xc # DW_AT_location > .byte 0x12 # DW_OP_dup > .byte 0x20 # DW_OP_not > .byte 0x28 # DW_OP_bra > .value 0x4 > .byte 0x34 # DW_OP_lit4 > .byte 0x2f # DW_OP_skip > .value 0x1 > .byte 0x30 # DW_OP_lit0 > .byte 0x16 # DW_OP_swap > .byte 0x13 # DW_OP_drop > > With Jakub's fix: > > .uleb128 0x8 # (DIE (0x5b) DW_TAG_dwarf_procedure) > .uleb128 0xd # DW_AT_location > .byte 0x12 # DW_OP_dup > .byte 0x30 # DW_OP_lit0 > .byte 0x29 # DW_OP_eq > .byte 0x28 # DW_OP_bra > .value 0x4 > .byte 0x34 # DW_OP_lit4 > .byte 0x2f # DW_OP_skip > .value 0x1 > .byte 0x30 # DW_OP_lit0 > .byte 0x16 # DW_OP_swap > .byte 0x13 # DW_OP_drop > > With mine: > > .uleb128 0x8 # (DIE (0x5b) DW_TAG_dwarf_procedure) > .uleb128 0xb # DW_AT_location > .byte 0x12 # DW_OP_dup > .byte 0x28 # DW_OP_bra > .value 0x4 > .byte 0x30 # DW_OP_lit0 > .byte 0x2f # DW_OP_skip > .value 0x1 > .byte 0x34 # DW_OP_lit4 > .byte 0x16 # DW_OP_swap > .byte 0x13 # DW_OP_drop > > > * dwarf2out.c (loc_list_from_tree_1) <TRUTH_NOT_EXPR>: Do a logical > instead of a bitwise negation. > <COND_EXPR>: Swap the operands if the condition is TRUTH_NOT_EXPR.
LGTM. Thanks, Richard. > -- > Eric Botcazou