tree-ssa-operands.c (add_virtual_operand): Consistently prune accesses.

2007-11-20  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-operands.c (add_virtual_operand): Consistently prune
	accesses.

	* gcc.c-torture/execute/20071120-1.c: New testcase.

From-SVN: r130315
This commit is contained in:
Richard Guenther 2007-11-20 15:16:25 +00:00 committed by Richard Biener
parent f22aa574dc
commit 8ef62eeb74
4 changed files with 90 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2007-11-20 Richard Guenther <rguenther@suse.de>
* tree-ssa-operands.c (add_virtual_operand): Consistently prune
accesses.
2007-11-20 Thiemo Seufer <ths@mips.com>
* config/mips/mips.c (mips_file_start): Add support for

View File

@ -1,3 +1,7 @@
2007-11-20 Richard Guenther <rguenther@suse.de>
* gcc.c-torture/execute/20071120-1.c: New testcase.
2007-11-20 Jakub Jelinek <jakub@redhat.com>
PR c/34146

View File

@ -0,0 +1,81 @@
extern void abort (void);
void __attribute__((noinline,noreturn))
vec_assert_fail (void)
{
abort ();
}
struct ggc_root_tab {
void *base;
};
typedef struct deferred_access_check {} VEC_deferred_access_check_gc;
typedef struct deferred_access {
VEC_deferred_access_check_gc* deferred_access_checks;
int deferring_access_checks_kind;
} deferred_access;
typedef struct VEC_deferred_access_base {
unsigned num;
deferred_access vec[1];
} VEC_deferred_access_base;
static __inline__ deferred_access *
VEC_deferred_access_base_last (VEC_deferred_access_base *vec_)
{
(void)((vec_ && vec_->num) ? 0 : (vec_assert_fail (), 0));
return &vec_->vec[vec_->num - 1];
}
static __inline__ void
VEC_deferred_access_base_pop (VEC_deferred_access_base *vec_)
{
(void)((vec_->num) ? 0 : (vec_assert_fail (), 0));
--vec_->num;
}
void __attribute__((noinline))
perform_access_checks (VEC_deferred_access_check_gc* p)
{
abort ();
}
typedef struct VEC_deferred_access_gc {
VEC_deferred_access_base base;
} VEC_deferred_access_gc;
static VEC_deferred_access_gc *deferred_access_stack;
static unsigned deferred_access_no_check;
const struct ggc_root_tab gt_pch_rs_gt_cp_semantics_h[] = {
{
&deferred_access_no_check
}
};
void __attribute__((noinline)) pop_to_parent_deferring_access_checks (void)
{
if (deferred_access_no_check)
deferred_access_no_check--;
else
{
VEC_deferred_access_check_gc *checks;
deferred_access *ptr;
checks = (VEC_deferred_access_base_last(deferred_access_stack ? &deferred_access_stack->base : 0))->deferred_access_checks;
VEC_deferred_access_base_pop(deferred_access_stack ? &deferred_access_stack->base : 0);
ptr = VEC_deferred_access_base_last(deferred_access_stack ? &deferred_access_stack->base : 0);
if (ptr->deferring_access_checks_kind == 0)
perform_access_checks (checks);
}
}
int main()
{
deferred_access_stack = __builtin_malloc (sizeof(VEC_deferred_access_gc) + sizeof(deferred_access) * 8);
deferred_access_stack->base.num = 2;
deferred_access_stack->base.vec[0].deferring_access_checks_kind = 1;
pop_to_parent_deferring_access_checks ();
return 0;
}

View File

@ -1531,7 +1531,6 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
unspecified [0, -1], we cannot prune it. Otherwise try doing
so using access_can_touch_variable. */
if (full_ref
&& !(offset == 0 && size == -1)
&& !access_can_touch_variable (full_ref, al, offset, size))
continue;