On 11/7/18 12:42 AM, Alexandre Oliva wrote:
> Before revision 254025, we'd reject UNSPECs in debug loc exprs.
> TARGET_CONST_NOT_OK_FOR_DEBUG_P still rejects that by default, on all
> ports that override it, except for x86, that accepts @gotoff unspecs.
> We can indeed accept them in top-level expressions, but not as
> subexpressions: the assembler rejects the difference between two
> @gotoff symbols, for example.
>
> We could simplify such a difference and drop the @gotoffs, provided
> that the symbols are in the same section; we could also accept
> @gotoffs plus literal constants. However, accepting those but
> rejecting such combinations as subexpressions would be ugly, and most
> likely not worth the trouble: sym@gotoff+litconst hardly makes sense
> as a standalone expression, and the difference between @gotoffs should
> be avoided to begin with, as follows.
>
> Ideally, the debug loc exprs would use the symbolic data in
> REG_EQUIV/REG_EQUAL notes, or delegitimized addresses, instead of
> simplifying the difference between two legitimized addresses so that
> the occurrences of the GOT register cancel each other. That would
> require some more elaborate surgery in var-tracking and cselib than
> would be appropriate at this stage.
>
> Regstrapped on x86_64- and i686-linux-gnu. Ok to install?
>
>
> for gcc/ChangeLog
>
> PR target/87793
> * config/i386/i386.c (ix86_const_not_ok_for_debug_p): Reject
> non-toplevel UNSPEC.
>
> for gcc/testsuite/ChangeLog
>
> PR target/87793
> * gcc.dg/pr87793.c: New.
OK.
jeff