On 11/06/2017 02:35 PM, Jakub Jelinek wrote:
> Hi!
>
> My recent changes to const_ok_for_output_1 to allow UNSPEC if target hook
> says it is ok for debug regressed the following testcase, where creative
> simplify-rtx.c changes result in (const (neg (unspec ... UNSPEC_GOTOFF)))
> being emitted and the backend not being able to assemble that (assembler
> has no such relocations).
> We already have a hack to avoid ICEing on NOT in similar cases, this patch
> adds NEG to that. And, in mem_loc_descriptor tries harder to handle these
> cases right - while if we have say (const (not (symbol_ref))) the current
> code would handle it right already, if there is the unspec, we really need
> it to be wrapped inside of CONST, otherwise it is dropped on the floor.
>
> The patch in that case emits (const (neg (unspec ... UNSPEC_GOTOFF)))
> as (neg (const (unspec ... UNSPEC_GOTOFF))).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-11-06 Jakub Jelinek <ja...@redhat.com>
>
> PR debug/82837
> * dwarf2out.c (const_ok_for_output_1): Reject NEG in addition to NOT.
> (mem_loc_descriptor): Handle (const (neg (...))) as (neg (const (...)))
> and similarly for not instead of neg.
>
> * gcc.dg/debug/dwarf2/pr82837.c: New test.
OK.
jeff