DWARF: fix stack usage assessment for DW_OP_neg
authorPierre-Marie de Rodat <derodat@adacore.com>
Tue, 10 May 2016 15:57:37 +0000 (15:57 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 10 May 2016 15:57:37 +0000 (15:57 +0000)
commitcd36c83e9bb1c8cf66082da63234925482695ef1
tree70b03e461d6650956ff172656edd2eeb9bc01fb3
parentafc610dba10fd532e83da10e19c5e0c5d7bcc34d
DWARF: fix stack usage assessment for DW_OP_neg

When the DWARF back-end generates DW_OP_neg operations in DWARF
procedures, we get an ICE because of inconsistent stack usage
computation for the embedding expression. This is because
resolve_args_picking_1 thinks DW_OP_neg is a binary operation (pops 2
stack slots, pushes 1) whereas it really is an unary one (one pop, one
push).

This change fixes resolve_args_picking_1 and adds a regression testcase
(which crashes with the current trunk).  Bootstrapped and regtested
without regression on x86_64-linux.

gcc/

* dwarf2out.c (resolve_args_picking_1): Consider DW_OP_neg as an
unary operation, not a binary one.

gcc/testsuite/

* gnat.dg/debug6.adb, gnat.dg/debug6_pkg.ads: New testcase.

From-SVN: r236087
gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/debug6.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/debug6_pkg.ads [new file with mode: 0644]