Commit 8fdbc9c6 by Zdenek Dvorak

re PR tree-optimization/27331 (segfault in fold_convert with -ftree-vectorize)

	PR tree-optimization/27331
	* tree-data-ref.c (free_data_ref): New function.
	(create_data_ref): Fail if the data reference has unknown access
	function.
	(free_data_refs): Use free_data_ref.

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

From-SVN: r114810
parent fe5568e9
2006-06-20 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/27331
* tree-data-ref.c (free_data_ref): New function.
(create_data_ref): Fail if the data reference has unknown access
function.
(free_data_refs): Use free_data_ref.
2006-06-19 Andrew Pinski <pinskia@gmail.com> 2006-06-19 Andrew Pinski <pinskia@gmail.com>
PR middle-end/28075 PR middle-end/28075
......
2006-06-20 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/27331
* gcc.dg/pr27331.c: New test.
2006-06-20 James A. Morrison <phython@gcc.gnu.org> 2006-06-20 James A. Morrison <phython@gcc.gnu.org>
Eric Botcazou <ebotcazou@adacore.com> Eric Botcazou <ebotcazou@adacore.com>
PR ada/18692 PR ada/18692
* lib/gnat.exp: New file. * lib/gnat.exp: New file.
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-vectorize" } */
struct funny_match
{
int this, other;
};
typedef struct rtx {
int code;
} *rtx;
extern rtx recog_operand[];
extern int which_alternative;
extern int nalternatives;
int
constrain_operands (insn_code_num, strict)
int insn_code_num;
int strict;
{
char *constraints[10];
struct funny_match funny_match[10];
register int c;
int funny_match_index;
which_alternative = 0;
while (which_alternative < nalternatives)
{
register int opno;
register char *p = constraints[opno];
int lose = 0;
funny_match_index = 0;
while (*p && (c = *p++) != ',')
funny_match[funny_match_index++].other = c - '0';
if ((((recog_operand[opno])->code) == 12))
lose = 1;
if (!lose)
{
while (--funny_match_index >= 0)
recog_operand[funny_match[funny_match_index].other]
= recog_operand[funny_match[funny_match_index].this];
return 1;
}
which_alternative++;
}
if (strict == 0)
return constrain_operands (insn_code_num, -1);
return 0;
}
...@@ -1854,6 +1854,18 @@ analyze_offset (tree offset, tree *invariant, tree *constant) ...@@ -1854,6 +1854,18 @@ analyze_offset (tree offset, tree *invariant, tree *constant)
*invariant = invariant_0 ? invariant_0 : invariant_1; *invariant = invariant_0 ? invariant_0 : invariant_1;
} }
/* Free the memory used by the data reference DR. */
static void
free_data_ref (data_reference_p dr)
{
if (DR_TYPE(dr) == ARRAY_REF_TYPE)
VEC_free (tree, heap, dr->object_info.access_fns);
else
VEC_free (tree, heap, dr->first_location.access_fns);
free (dr);
}
/* Function create_data_ref. /* Function create_data_ref.
...@@ -1954,11 +1966,23 @@ create_data_ref (tree memref, tree stmt, bool is_read) ...@@ -1954,11 +1966,23 @@ create_data_ref (tree memref, tree stmt, bool is_read)
/* Update access function. */ /* Update access function. */
access_fn = DR_ACCESS_FN (dr, 0); access_fn = DR_ACCESS_FN (dr, 0);
if (automatically_generated_chrec_p (access_fn))
{
free_data_ref (dr);
return NULL;
}
new_step = size_binop (TRUNC_DIV_EXPR, new_step = size_binop (TRUNC_DIV_EXPR,
fold_convert (ssizetype, step), type_size); fold_convert (ssizetype, step), type_size);
init_cond = chrec_convert (chrec_type (access_fn), init_cond, stmt); init_cond = chrec_convert (chrec_type (access_fn), init_cond, stmt);
new_step = chrec_convert (chrec_type (access_fn), new_step, stmt); new_step = chrec_convert (chrec_type (access_fn), new_step, stmt);
if (automatically_generated_chrec_p (init_cond)
|| automatically_generated_chrec_p (new_step))
{
free_data_ref (dr);
return NULL;
}
access_fn = chrec_replace_initial_condition (access_fn, init_cond); access_fn = chrec_replace_initial_condition (access_fn, init_cond);
access_fn = reset_evolution_in_loop (loop->num, access_fn, new_step); access_fn = reset_evolution_in_loop (loop->num, access_fn, new_step);
...@@ -4373,14 +4397,7 @@ free_data_refs (VEC (data_reference_p, heap) *datarefs) ...@@ -4373,14 +4397,7 @@ free_data_refs (VEC (data_reference_p, heap) *datarefs)
struct data_reference *dr; struct data_reference *dr;
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++) for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{ free_data_ref (dr);
if (DR_TYPE(dr) == ARRAY_REF_TYPE)
VEC_free (tree, heap, (dr)->object_info.access_fns);
else
VEC_free (tree, heap, (dr)->first_location.access_fns);
free (dr);
}
VEC_free (data_reference_p, heap, datarefs); VEC_free (data_reference_p, heap, datarefs);
} }
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