]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR87793] reject non-toplevel unspecs in debug loc exprs on x86
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2018 10:15:46 +0000 (10:15 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Nov 2018 10:15:46 +0000 (10:15 +0000)
commit2a6c0337e4d6bc90cea3da4d5d7e2da3d5509c23
tree9e3182aa55b56ce57d525afb4fec66630be2ae02
parent7a262d5d96f2802c0d80ba505c148c592b84e2bb
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265956 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr87793.c [new file with mode: 0644]