Commit cd36c83e by Pierre-Marie de Rodat Committed by Pierre-Marie de Rodat

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
parent afc610db
2016-05-10 Pierre-Marie de Rodat <derodat@adacore.com>
* dwarf2out.c (resolve_args_picking_1): Consider DW_OP_neg as an
unary operation, not a binary one.
2016-05-10 Ilya Enkovich <ilya.enkovich@intel.com> 2016-05-10 Ilya Enkovich <ilya.enkovich@intel.com>
PR tree-optimization/70786 PR tree-optimization/70786
......
...@@ -15407,6 +15407,7 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset, ...@@ -15407,6 +15407,7 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset,
case DW_OP_swap: case DW_OP_swap:
case DW_OP_rot: case DW_OP_rot:
case DW_OP_abs: case DW_OP_abs:
case DW_OP_neg:
case DW_OP_not: case DW_OP_not:
case DW_OP_plus_uconst: case DW_OP_plus_uconst:
case DW_OP_skip: case DW_OP_skip:
...@@ -15543,7 +15544,6 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset, ...@@ -15543,7 +15544,6 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset,
case DW_OP_minus: case DW_OP_minus:
case DW_OP_mod: case DW_OP_mod:
case DW_OP_mul: case DW_OP_mul:
case DW_OP_neg:
case DW_OP_or: case DW_OP_or:
case DW_OP_plus: case DW_OP_plus:
case DW_OP_shl: case DW_OP_shl:
......
2016-05-10 Pierre-Marie de Rodat <derodat@adacore.com>
* gnat.dg/debug6.adb, gnat.dg/debug6_pkg.ads: New testcase.
2016-05-10 Ilya Enkovich <ilya.enkovich@intel.com> 2016-05-10 Ilya Enkovich <ilya.enkovich@intel.com>
PR tree-optimization/70786 PR tree-optimization/70786
......
-- { dg-do compile }
-- { dg-options "-g" }
with Debug6_Pkg; use Debug6_Pkg;
procedure Debug6 is
V : Value := (Kind => Undefined);
begin
Process (V);
end Debug6;
package Debug6_Pkg is
type Vkind is (Int, Undefined);
for Vkind use (Int => -2 ** 31, Undefined => 0);
type Value (Kind : Vkind) is record
case Kind is
when Undefined => null;
when Int => Value : Integer;
when others => null;
end case;
end record;
procedure Process (V : Value);
end Debug6_Pkg;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment