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

2022-05-16 Thread Jakub Jelinek via Gcc-patches
On Mon, May 16, 2022 at 10:47:53AM +0200, Eric Botcazou wrote: > > It won't work for types larger than size of address, it would need to use > > dwarf_OP (DW_OP_const_type) instead of DW_OP_lit0 in that case. > > But maybe TRUTH_NOT_EXPR will be never seen for such types and after all, > > even the

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

2022-05-16 Thread Eric Botcazou via Gcc-patches
> It won't work for types larger than size of address, it would need to use > dwarf_OP (DW_OP_const_type) instead of DW_OP_lit0 in that case. > But maybe TRUTH_NOT_EXPR will be never seen for such types and after all, > even the loc_list_from_tree_1 INTEGER_CST case doesn't handle that > (the RTL c

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

2022-05-16 Thread Jakub Jelinek via Gcc-patches
On Mon, May 16, 2022 at 09:45:18AM +0200, Richard Biener via Gcc-patches wrote: > > * dwarf2out.c (loc_list_from_tree_1) : Do a logical > > instead of a bitwise negation. > > : Swap the operands if the condition is TRUTH_NOT_EXPR. > > LGTM. It won't work for types larger t

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

2022-05-16 Thread Richard Biener via Gcc-patches
On Mon, May 16, 2022 at 9:06 AM Eric Botcazou 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 te

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

2022-05-16 Thread Eric Botcazou via Gcc-patches
> 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) D

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

2022-05-13 Thread Jakub Jelinek via Gcc-patches
On Fri, May 13, 2022 at 10:25:02AM +0200, Richard Biener via Gcc-patches wrote: > On Fri, May 13, 2022 at 10:21 AM Eric Botcazou via Gcc-patches > wrote: > > > > Hi, > > > > DW_OP_not is a bitwise, not a logical NOT, so it computes the wrong result > > in > > a DWARF conditional expression. > > >

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

2022-05-13 Thread Eric Botcazou via Gcc-patches
> But this doesn't fix > > case TRUTH_NOT_EXPR: > case BIT_NOT_EXPR: > op = DW_OP_not; > goto do_unop; Nope (I couldn't trigger it after my change). > I also wonder where we get the TRUTH_NOT_EXPR to expand from? I suspect > some non-gimplified global tree? Yes, it's in the

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

2022-05-13 Thread Richard Biener via Gcc-patches
On Fri, May 13, 2022 at 10:21 AM Eric Botcazou via Gcc-patches 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_E

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

2022-05-13 Thread Eric Botcazou via Gcc-patches
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? 2022-05-13 Eric Botcazou * dwarf2out.c (loc_list_from_tree_1) : Swap the operands if the condition is a