Commit 17cb4283 by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/64663 (ICE at -O1 and above with -g enabled on x86_64-linux-gnu)

	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: r219906
parent 73cb399d
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-20 Chung-Lin Tang <cltang@codesourcery.com> 2015-01-20 Chung-Lin Tang <cltang@codesourcery.com>
* config/nios2/nios2.c (nios2_asm_file_end): Implement * config/nios2/nios2.c (nios2_asm_file_end): Implement
......
...@@ -5062,7 +5062,7 @@ equate_decl_number_to_die (tree decl, dw_die_ref decl_die) ...@@ -5062,7 +5062,7 @@ equate_decl_number_to_die (tree decl, dw_die_ref decl_die)
/* Return how many bits covers PIECE EXPR_LIST. */ /* Return how many bits covers PIECE EXPR_LIST. */
static int static HOST_WIDE_INT
decl_piece_bitsize (rtx piece) decl_piece_bitsize (rtx piece)
{ {
int ret = (int) GET_MODE (piece); int ret = (int) GET_MODE (piece);
...@@ -5090,7 +5090,7 @@ decl_piece_varloc_ptr (rtx piece) ...@@ -5090,7 +5090,7 @@ decl_piece_varloc_ptr (rtx piece)
static rtx_expr_list * static rtx_expr_list *
decl_piece_node (rtx loc_note, HOST_WIDE_INT bitsize, rtx next) 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); return alloc_EXPR_LIST (bitsize, loc_note, next);
else else
return alloc_EXPR_LIST (0, gen_rtx_CONCAT (VOIDmode, return alloc_EXPR_LIST (0, gen_rtx_CONCAT (VOIDmode,
...@@ -5129,7 +5129,7 @@ adjust_piece_list (rtx *dest, rtx *src, rtx *inner, ...@@ -5129,7 +5129,7 @@ adjust_piece_list (rtx *dest, rtx *src, rtx *inner,
HOST_WIDE_INT bitpos, HOST_WIDE_INT piece_bitpos, HOST_WIDE_INT bitpos, HOST_WIDE_INT piece_bitpos,
HOST_WIDE_INT bitsize, rtx loc_note) HOST_WIDE_INT bitsize, rtx loc_note)
{ {
int diff; HOST_WIDE_INT diff;
bool copy = inner != NULL; bool copy = inner != NULL;
if (copy) if (copy)
...@@ -5269,7 +5269,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label) ...@@ -5269,7 +5269,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
{ {
struct var_loc_node *last = temp->last, *unused = NULL; struct var_loc_node *last = temp->last, *unused = NULL;
rtx *piece_loc = NULL, last_loc_note; rtx *piece_loc = NULL, last_loc_note;
int piece_bitpos = 0; HOST_WIDE_INT piece_bitpos = 0;
if (last->next) if (last->next)
{ {
last = last->next; last = last->next;
...@@ -5280,7 +5280,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label) ...@@ -5280,7 +5280,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
piece_loc = &last->loc; piece_loc = &last->loc;
do 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) if (piece_bitpos + cur_bitsize > bitpos)
break; break;
piece_bitpos += cur_bitsize; piece_bitpos += cur_bitsize;
...@@ -13924,7 +13924,7 @@ static dw_loc_descr_ref ...@@ -13924,7 +13924,7 @@ static dw_loc_descr_ref
dw_sra_loc_expr (tree decl, rtx loc) dw_sra_loc_expr (tree decl, rtx loc)
{ {
rtx p; rtx p;
unsigned int padsize = 0; unsigned HOST_WIDE_INT padsize = 0;
dw_loc_descr_ref descr, *descr_tail; dw_loc_descr_ref descr, *descr_tail;
unsigned HOST_WIDE_INT decl_size; unsigned HOST_WIDE_INT decl_size;
rtx varloc; rtx varloc;
...@@ -13940,11 +13940,11 @@ dw_sra_loc_expr (tree decl, rtx loc) ...@@ -13940,11 +13940,11 @@ dw_sra_loc_expr (tree decl, rtx loc)
for (p = loc; p; p = XEXP (p, 1)) 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); rtx loc_note = *decl_piece_varloc_ptr (p);
dw_loc_descr_ref cur_descr; dw_loc_descr_ref cur_descr;
dw_loc_descr_ref *tail, last = NULL; dw_loc_descr_ref *tail, last = NULL;
unsigned int opsize = 0; unsigned HOST_WIDE_INT opsize = 0;
if (loc_note == NULL_RTX if (loc_note == NULL_RTX
|| NOTE_VAR_LOCATION_LOC (loc_note) == NULL_RTX) || NOTE_VAR_LOCATION_LOC (loc_note) == NULL_RTX)
......
2015-01-20 Jakub Jelinek <jakub@redhat.com>
PR debug/64663
* gcc.dg/pr64663.c: New test.
2015-01-20 Paolo Carlini <paolo.carlini@oracle.com> 2015-01-20 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/64383 PR c++/64383
......
/* 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;
}
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