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
This commit is contained in:
Zdenek Dvorak 2006-06-20 10:26:45 +00:00
parent fe5568e990
commit 8fdbc9c6eb
4 changed files with 95 additions and 9 deletions

View File

@ -1,3 +1,11 @@
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>
PR middle-end/28075

View File

@ -1,5 +1,10 @@
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>
Eric Botcazou <ebotcazou@adacore.com>
Eric Botcazou <ebotcazou@adacore.com>
PR ada/18692
* lib/gnat.exp: New file.

View File

@ -0,0 +1,56 @@
/* { 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;
}

View File

@ -1854,6 +1854,18 @@ analyze_offset (tree offset, tree *invariant, tree *constant)
*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.
@ -1954,11 +1966,23 @@ create_data_ref (tree memref, tree stmt, bool is_read)
/* Update access function. */
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,
fold_convert (ssizetype, step), type_size);
init_cond = chrec_convert (chrec_type (access_fn), init_cond, 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 = reset_evolution_in_loop (loop->num, access_fn, new_step);
@ -4373,14 +4397,7 @@ free_data_refs (VEC (data_reference_p, heap) *datarefs)
struct data_reference *dr;
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
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);
}
free_data_ref (dr);
VEC_free (data_reference_p, heap, datarefs);
}