diff options
author | Richard Guenther <rguenther@suse.de> | 2010-07-22 12:14:27 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-07-22 12:14:27 +0000 |
commit | 5ccbfc1fb8c8e30f15cb74696aa97956a10c5103 (patch) | |
tree | 7ce6db24c7d1e48bf57676eca6afc1c3d54bcd6f /gcc/tree-ssa-sccvn.c | |
parent | e1d818f7eabdac4b3a814866fe05e4f2a82860ed (diff) | |
download | gcc-5ccbfc1fb8c8e30f15cb74696aa97956a10c5103.zip gcc-5ccbfc1fb8c8e30f15cb74696aa97956a10c5103.tar.gz gcc-5ccbfc1fb8c8e30f15cb74696aa97956a10c5103.tar.bz2 |
re PR middle-end/45017 (miscompile with bitfield and optimization)
2010-07-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45017
* tree-ssa-sccvn.c (vn_reference_eq): Make sure we honor
TYPE_PRECISION of integral types in addition to size.
* gcc.c-torture/execute/pr45017.c: New testcase.
From-SVN: r162411
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 8eafd9b..c99c8a8 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -498,6 +498,21 @@ vn_reference_eq (const void *p1, const void *p2) if (!expressions_equal_p (TYPE_SIZE (vr1->type), TYPE_SIZE (vr2->type))) return false; + if (INTEGRAL_TYPE_P (vr1->type) + && INTEGRAL_TYPE_P (vr2->type)) + { + if (TYPE_PRECISION (vr1->type) != TYPE_PRECISION (vr2->type)) + return false; + } + else if (INTEGRAL_TYPE_P (vr1->type) + && (TYPE_PRECISION (vr1->type) + != TREE_INT_CST_LOW (TYPE_SIZE (vr1->type)))) + return false; + else if (INTEGRAL_TYPE_P (vr2->type) + && (TYPE_PRECISION (vr2->type) + != TREE_INT_CST_LOW (TYPE_SIZE (vr2->type)))) + return false; + i = 0; j = 0; do |