]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/64663 (ICE at -O1 and above with -g enabled on x86_64-linux...
authorJakub Jelinek <jakub@redhat.com>
Sun, 1 Feb 2015 17:31:48 +0000 (18:31 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 17:31:48 +0000 (18:31 +0100)
Backported from mainline
2015-01-20  Jakub Jelinek  <jakub@redhat.com>

PR debug/64663
* dwarf2out.c (decl_piece_node): Don't put bitsize into
mode if bitsize <= 0.
(decl_piece_bitsize, adjust_piece_list, add_var_loc_to_decl,
dw_sra_loc_expr): Use HOST_WIDE_INT instead of int for bit
sizes and positions.

* gcc.dg/pr64663.c: New test.

From-SVN: r220321

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr64663.c [new file with mode: 0644]

index c2c1d025af673014e894f970c40e65200f4210e7..ca6b745fc6470904f6a319e12b94c34a23ba2384 100644 (file)
@@ -1,3 +1,15 @@
+2015-02-01  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2015-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/64663
+       * dwarf2out.c (decl_piece_node): Don't put bitsize into
+       mode if bitsize <= 0.
+       (decl_piece_bitsize, adjust_piece_list, add_var_loc_to_decl,
+       dw_sra_loc_expr): Use HOST_WIDE_INT instead of int for bit
+       sizes and positions.
+
 2015-01-29  Ilya Tocar  <ilya.tocar@intel.com>
 
        * config/i386/avx2intrin.h (_mm256_bslli_epi128,
index d48895cde6e45bf7d75a8db5afcf970f26c52dd1..23319d0d17de30479e959a8be3d909845df89194 100644 (file)
@@ -4930,7 +4930,7 @@ equate_decl_number_to_die (tree decl, dw_die_ref decl_die)
 
 /* Return how many bits covers PIECE EXPR_LIST.  */
 
-static int
+static HOST_WIDE_INT
 decl_piece_bitsize (rtx piece)
 {
   int ret = (int) GET_MODE (piece);
@@ -4958,7 +4958,7 @@ decl_piece_varloc_ptr (rtx piece)
 static rtx
 decl_piece_node (rtx loc_note, HOST_WIDE_INT bitsize, rtx next)
 {
-  if (bitsize <= (int) MAX_MACHINE_MODE)
+  if (bitsize > 0 && bitsize <= (int) MAX_MACHINE_MODE)
     return alloc_EXPR_LIST (bitsize, loc_note, next);
   else
     return alloc_EXPR_LIST (0, gen_rtx_CONCAT (VOIDmode,
@@ -4997,7 +4997,7 @@ adjust_piece_list (rtx *dest, rtx *src, rtx *inner,
                   HOST_WIDE_INT bitpos, HOST_WIDE_INT piece_bitpos,
                   HOST_WIDE_INT bitsize, rtx loc_note)
 {
-  int diff;
+  HOST_WIDE_INT diff;
   bool copy = inner != NULL;
 
   if (copy)
@@ -5137,7 +5137,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
     {
       struct var_loc_node *last = temp->last, *unused = NULL;
       rtx *piece_loc = NULL, last_loc_note;
-      int piece_bitpos = 0;
+      HOST_WIDE_INT piece_bitpos = 0;
       if (last->next)
        {
          last = last->next;
@@ -5148,7 +5148,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
          piece_loc = &last->loc;
          do
            {
-             int cur_bitsize = decl_piece_bitsize (*piece_loc);
+             HOST_WIDE_INT cur_bitsize = decl_piece_bitsize (*piece_loc);
              if (piece_bitpos + cur_bitsize > bitpos)
                break;
              piece_bitpos += cur_bitsize;
@@ -13573,7 +13573,7 @@ static dw_loc_descr_ref
 dw_sra_loc_expr (tree decl, rtx loc)
 {
   rtx p;
-  unsigned int padsize = 0;
+  unsigned HOST_WIDE_INT padsize = 0;
   dw_loc_descr_ref descr, *descr_tail;
   unsigned HOST_WIDE_INT decl_size;
   rtx varloc;
@@ -13589,11 +13589,11 @@ dw_sra_loc_expr (tree decl, rtx loc)
 
   for (p = loc; p; p = XEXP (p, 1))
     {
-      unsigned int bitsize = decl_piece_bitsize (p);
+      unsigned HOST_WIDE_INT bitsize = decl_piece_bitsize (p);
       rtx loc_note = *decl_piece_varloc_ptr (p);
       dw_loc_descr_ref cur_descr;
       dw_loc_descr_ref *tail, last = NULL;
-      unsigned int opsize = 0;
+      unsigned HOST_WIDE_INT opsize = 0;
 
       if (loc_note == NULL_RTX
          || NOTE_VAR_LOCATION_LOC (loc_note) == NULL_RTX)
index c0122c32e378e89ec80056f28bdc1404c1c469f9..d063440f0146e29070ceec0f85d957344e5f4baf 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-01  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2015-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/64663
+       * gcc.dg/pr64663.c: New test.
+
 2015-01-29  Ilya Tocar  <ilya.tocar@intel.com>
 
        * gcc.target/i386/sse-14.c: Test new intrinsic.
diff --git a/gcc/testsuite/gcc.dg/pr64663.c b/gcc/testsuite/gcc.dg/pr64663.c
new file mode 100644 (file)
index 0000000..9a0bf0d
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR debug/64663 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -w" } */
+
+void
+foo (void)
+{
+  int a[9];
+  a[-8] = 0;
+}
+
+void
+bar (void)
+{
+  int a[9];
+  a[-9] = 0;
+}