diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-12-01 10:24:55 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-12-01 10:24:55 +0100 |
commit | d26b3eb7658b48e6dadec752755f864652f19591 (patch) | |
tree | f3854e70ac4403b06fc4365497d9de9c5d72f937 | |
parent | 43d0b501eec49d6d4092fe0e5299aedf1d743124 (diff) | |
download | gcc-d26b3eb7658b48e6dadec752755f864652f19591.zip gcc-d26b3eb7658b48e6dadec752755f864652f19591.tar.gz gcc-d26b3eb7658b48e6dadec752755f864652f19591.tar.bz2 |
re PR debug/78587 (dwarf2out.c:1517:45: runtime error: negation of -9223372036854775808 cannot be represented in type 'long int [4]'; cast to an unsigned type to negate this value to itself)
PR debug/78587
* dwarf2out.c (loc_descr_plus_const): For negative offset use
uint_loc_descriptor instead of int_loc_descriptor and perform negation
in unsigned HOST_WIDE_INT type.
(scompare_loc_descriptor): Shift UINTVAL left instead of INTVAL.
* gcc.dg/debug/pr78587.c: New test.
From-SVN: r243100
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/pr78587.c | 23 |
4 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b3cc6305..ef945b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-12-01 Jakub Jelinek <jakub@redhat.com> + PR debug/78587 + * dwarf2out.c (loc_descr_plus_const): For negative offset use + uint_loc_descriptor instead of int_loc_descriptor and perform negation + in unsigned HOST_WIDE_INT type. + (scompare_loc_descriptor): Shift UINTVAL left instead of INTVAL. + PR target/78614 * config/rs6000/rs6000.c (rs6000_frame_related): Call set_used_flags (pat) before any simplifications. Clear used flag on diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 66a4919..bc328ab 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1514,7 +1514,8 @@ loc_descr_plus_const (dw_loc_descr_ref *list_head, HOST_WIDE_INT offset) else { - loc->dw_loc_next = int_loc_descriptor (-offset); + loc->dw_loc_next + = uint_loc_descriptor (-(unsigned HOST_WIDE_INT) offset); add_loc_descr (&loc->dw_loc_next, new_loc_descr (DW_OP_minus, 0, 0)); } } @@ -13837,7 +13838,7 @@ scompare_loc_descriptor (enum dwarf_location_atom op, rtx rtl, if (CONST_INT_P (XEXP (rtl, 1)) && GET_MODE_BITSIZE (op_mode) < HOST_BITS_PER_WIDE_INT && (size_of_int_loc_descriptor (shift) + 1 - + size_of_int_loc_descriptor (INTVAL (XEXP (rtl, 1)) << shift) + + size_of_int_loc_descriptor (UINTVAL (XEXP (rtl, 1)) << shift) >= size_of_int_loc_descriptor (GET_MODE_MASK (op_mode)) + 1 + size_of_int_loc_descriptor (INTVAL (XEXP (rtl, 1)) & GET_MODE_MASK (op_mode)))) @@ -13852,7 +13853,7 @@ scompare_loc_descriptor (enum dwarf_location_atom op, rtx rtl, add_loc_descr (&op0, int_loc_descriptor (shift)); add_loc_descr (&op0, new_loc_descr (DW_OP_shl, 0, 0)); if (CONST_INT_P (XEXP (rtl, 1))) - op1 = int_loc_descriptor (INTVAL (XEXP (rtl, 1)) << shift); + op1 = int_loc_descriptor (UINTVAL (XEXP (rtl, 1)) << shift); else { add_loc_descr (&op1, int_loc_descriptor (shift)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf4bd8a..2d1c182 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-01 Jakub Jelinek <jakub@redhat.com> + + PR debug/78587 + * gcc.dg/debug/pr78587.c: New test. + 2016-12-01 Segher Boessenkool <segher@kernel.crashing.org> PR rtl-optimization/78607 diff --git a/gcc/testsuite/gcc.dg/debug/pr78587.c b/gcc/testsuite/gcc.dg/debug/pr78587.c new file mode 100644 index 0000000..b368a2a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr78587.c @@ -0,0 +1,23 @@ +/* PR debug/78587 */ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +extern void bar (void); + +void +foo (long long x) +{ + x ^= 9223372036854775808ULL; + bar (); +} + +struct S { int w[4]; } a[1], b; + +void +baz () +{ + int e = (int) baz; + if (e <= -80) + e = 0; + b = a[e]; +} |