On Mon, Apr 26, 2021 at 06:49:22PM +0200, Eric Botcazou wrote: > the compiler can synthesize DWARF functions to describe the location and size > of components in discriminated record types with variant part in Ada, but in > peculiar cases the compiler drops expressions on the floor, for example in > the divide case: > > case ROUND_DIV_EXPR: > case TRUNC_DIV_EXPR: > case EXACT_DIV_EXPR: > if (TYPE_UNSIGNED (TREE_TYPE (loc))) > return 0; > op = DW_OP_div; > goto do_binop; > > Now sizetype and bitsizetype are unsigned types, which means that any divide > expression in them is dropped. But the sign bit is expected to be never set > for sizetype or bitsizetype quantities so that's unnecessarily cautious. > > Tested on x86-64/Linux, both GCC and GDB, OK for the mainline?
At least sizetype is for GIMPLE compatible with size_t or unsigned long (or whatever unsigned type has the same precision), so this looks wrong to me. For non-strict DWARF or DWARF5 and above, I don't see why we can't use typed DWARF ops instead though, see what e.g. mem_loc_descriptor does for UDIV. Jakub