2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-15 13:30:59 +08:00

re PR tree-optimization/45535 (ICE during tree_ssa_dse)

2010-09-05  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45535
	* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Properly
	handle TMR_INDEX2.  Make sure TMR_INDEX is not NULL before
	dereferencing it.
	(indirect_refs_may_alias_p): Likewise.

	* gcc.c-torture/compile/pr45535.c: New testcase.

From-SVN: r163877
This commit is contained in:
Richard Guenther 2010-09-05 10:47:05 +00:00 committed by Richard Biener
parent e7a8f681c0
commit f38fb2c44b
4 changed files with 65 additions and 5 deletions
gcc
ChangeLog
testsuite
ChangeLog
gcc.c-torture/compile
tree-ssa-alias.c

@ -1,3 +1,11 @@
2010-09-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45535
* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Properly
handle TMR_INDEX2. Make sure TMR_INDEX is not NULL before
dereferencing it.
(indirect_refs_may_alias_p): Likewise.
2010-09-05 Naveen H.S <naveen.S@kpitcummins.com>
* config/sh/sh.c (sh_option_override): Make static.

@ -1,3 +1,8 @@
2010-09-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45535
* gcc.c-torture/compile/pr45535.c: New testcase.
2010-09-04 Andreas Schwab <schwab@linux-m68k.org>
* g++.dg/debug/dwarf2/global-used-types-1.C: Replace ".*" by

@ -0,0 +1,38 @@
typedef struct {
unsigned long pmd0;
unsigned long pmd1;
} pmd_t;
typedef unsigned int pgd_t;
struct mm_struct {
pgd_t * pgd;
};
extern inline int pmd_bad(pmd_t pmd)
{
}
extern inline void pmd_clear(pmd_t * pmdp)
{
((*pmdp).pmd0) = 0x20 | 0x00;
((*pmdp).pmd1) = 0x20 | 0x00;
}
static inline void free_one_pmd(pmd_t * dir)
{
if (pmd_bad(*dir)) {
pmd_clear(dir);
}
}
static inline void free_one_pgd(pgd_t * dir)
{
int j;
pmd_t * pmd;
pmd = ((pmd_t *) ((unsigned long) (void *)(__pgd_val(dir) & (~((1UL << 12)-1)))) + (((0) >> 21) & (512 - 1)));
for (j = 0; j < 512 ; j++) {
free_one_pmd(pmd+j);
}
}
void clear_page_tables(struct mm_struct *mm, unsigned long first, int nr)
{
pgd_t * page_dir = mm->pgd;
do {
free_one_pgd(page_dir);
} while (--nr);
}

@ -693,7 +693,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
(the pointer base cannot validly point to an offset less than zero
of the variable).
They also cannot alias if the pointer may not point to the decl. */
if ((TREE_CODE (base1) != TARGET_MEM_REF || !TMR_INDEX (base1))
if ((TREE_CODE (base1) != TARGET_MEM_REF
|| (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
&& !ranges_overlap_p (MAX (0, offset1p), -1, offset2p, max_size2))
return false;
if (!ptr_deref_may_alias_decl_p (ptr1, base2))
@ -725,7 +726,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
is relative to the start of the type which we ensure by
comparing rvalue and access type and disregarding the constant
pointer offset. */
if ((TREE_CODE (base1) != TARGET_MEM_REF || !TMR_INDEX (base1))
if ((TREE_CODE (base1) != TARGET_MEM_REF
|| (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
&& (TREE_CODE (base1) != MEM_REF
|| same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)
&& same_type_for_tbaa (TREE_TYPE (ptrtype1), TREE_TYPE (base2)) == 1)
@ -807,16 +809,23 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
if ((!cfun || gimple_in_ssa_p (cfun))
&& operand_equal_p (ptr1, ptr2, 0)
&& (((TREE_CODE (base1) != TARGET_MEM_REF
|| !TMR_INDEX (base1))
|| (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
&& (TREE_CODE (base2) != TARGET_MEM_REF
|| !TMR_INDEX (base2)))
|| (!TMR_INDEX (base2) && !TMR_INDEX2 (base2))))
|| (TREE_CODE (base1) == TARGET_MEM_REF
&& TREE_CODE (base2) == TARGET_MEM_REF
&& (TMR_STEP (base1) == TMR_STEP (base2)
|| (TMR_STEP (base1) && TMR_STEP (base2)
&& operand_equal_p (TMR_STEP (base1),
TMR_STEP (base2), 0)))
&& operand_equal_p (TMR_INDEX (base1), TMR_INDEX (base2), 0))))
&& (TMR_INDEX (base1) == TMR_INDEX (base2)
|| (TMR_INDEX (base1) && TMR_INDEX (base2)
&& operand_equal_p (TMR_INDEX (base1),
TMR_INDEX (base2), 0)))
&& (TMR_INDEX2 (base1) == TMR_INDEX2 (base2)
|| (TMR_INDEX2 (base1) && TMR_INDEX2 (base2)
&& operand_equal_p (TMR_INDEX2 (base1),
TMR_INDEX2 (base2), 0))))))
{
/* The offset embedded in MEM_REFs can be negative. Bias them
so that the resulting offset adjustment is positive. */