diff options
author | Richard Guenther <rguenther@suse.de> | 2010-09-05 10:47:05 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-09-05 10:47:05 +0000 |
commit | f38fb2c44b2a6333581e8a4cc314efb00ce7d18a (patch) | |
tree | 67feb12fc771c5fabd29cc9489e084e60304dbdd /gcc | |
parent | e7a8f681c069f09f53be3f94e220669247379a48 (diff) | |
download | gcc-f38fb2c44b2a6333581e8a4cc314efb00ce7d18a.zip gcc-f38fb2c44b2a6333581e8a4cc314efb00ce7d18a.tar.gz gcc-f38fb2c44b2a6333581e8a4cc314efb00ce7d18a.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr45535.c | 38 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 19 |
4 files changed, 65 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab41e8b..daef269 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb5661b..ff909fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr45535.c b/gcc/testsuite/gcc.c-torture/compile/pr45535.c new file mode 100644 index 0000000..03d15a1 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr45535.c @@ -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); +} diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index a9f1c19..e00c50a 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -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. */ |