diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2010-02-26 23:10:24 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2010-02-26 23:10:24 +0000 |
commit | 2743db69c542d154285c02b6a4747910308d533c (patch) | |
tree | ec9d98330876d3ba346f39cd43c4a0c4354aa4f4 /gcc/tree-ssa-alias.c | |
parent | 4d16c0dc918215ef04402f808d0504b0b52d306d (diff) | |
download | gcc-2743db69c542d154285c02b6a4747910308d533c.zip gcc-2743db69c542d154285c02b6a4747910308d533c.tar.gz gcc-2743db69c542d154285c02b6a4747910308d533c.tar.bz2 |
re PR ada/43096 (miscompilation of ACATS c37105a at -O2)
PR ada/43096
* tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have
the same alias set.
From-SVN: r157102
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index b235ecc..73a1637 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -544,13 +544,15 @@ same_type_for_tbaa (tree type1, tree type2) && TREE_CODE (type2) == ARRAY_TYPE) return -1; - /* In Ada, an lvalue of unconstrained type can be used to access an object - of one of its constrained subtypes, for example when a function with an - unconstrained parameter passed by reference is called on a constrained - object and inlined. In this case, the types have the same alias set. */ - if (TYPE_SIZE (type1) && TYPE_SIZE (type2) - && TREE_CONSTANT (TYPE_SIZE (type1)) != TREE_CONSTANT (TYPE_SIZE (type2)) - && get_alias_set (type1) == get_alias_set (type2)) + /* ??? In Ada, an lvalue of an unconstrained type can be used to access an + object of one of its constrained subtypes, e.g. when a function with an + unconstrained parameter passed by reference is called on an object and + inlined. But, even in the case of a fixed size, type and subtypes are + not equivalent enough as to share the same TYPE_CANONICAL, since this + would mean that conversions between them are useless, whereas they are + not (e.g. type and subtypes can have different modes). So, in the end, + they are only guaranteed to have the same alias set. */ + if (get_alias_set (type1) == get_alias_set (type2)) return -1; /* The types are known to be not equal. */ |