https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87793

--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Author: aoliva
Date: Fri Nov  9 10:15:46 2018
New Revision: 265956

URL: https://gcc.gnu.org/viewcvs?rev=265956&root=gcc&view=rev
Log:
[PR87793] reject non-toplevel unspecs in debug loc exprs on x86

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.

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.

Added:
    trunk/gcc/testsuite/gcc.dg/pr87793.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog

Reply via email to