diff options
author | Richard Henderson <rth@gcc.gnu.org> | 2016-02-05 14:05:17 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2016-02-05 14:05:17 -0800 |
commit | be2083eab7d8d276bafcd63b02fbf8ed0748e8d4 (patch) | |
tree | 9256eb829d4d9384df1f7ec1343fb1516759dc3d /gcc/tree.c | |
parent | 711d7c231fc6a5a04f65568cf17a47c270527a09 (diff) | |
download | gcc-be2083eab7d8d276bafcd63b02fbf8ed0748e8d4.zip gcc-be2083eab7d8d276bafcd63b02fbf8ed0748e8d4.tar.gz gcc-be2083eab7d8d276bafcd63b02fbf8ed0748e8d4.tar.bz2 |
re PR middle-end/69643 (Address space discarded)
PR c/69643
* tree.c (tree_nop_conversion_p): Do not strip casts into or
out of non-standard address spaces.
testsuite/
* gcc.target/i386/addr-space-4.c: New.
* gcc.target/i386/addr-space-5.c: New.
From-SVN: r233189
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -12219,6 +12219,23 @@ block_ultimate_origin (const_tree block) bool tree_nop_conversion_p (const_tree outer_type, const_tree inner_type) { + /* Do not strip casts into or out of differing address spaces. */ + if (POINTER_TYPE_P (outer_type) + && TYPE_ADDR_SPACE (TREE_TYPE (outer_type)) != ADDR_SPACE_GENERIC) + { + if (!POINTER_TYPE_P (inner_type) + || (TYPE_ADDR_SPACE (TREE_TYPE (outer_type)) + != TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))) + return false; + } + else if (POINTER_TYPE_P (inner_type) + && TYPE_ADDR_SPACE (TREE_TYPE (inner_type)) != ADDR_SPACE_GENERIC) + { + /* We already know that outer_type is not a pointer with + a non-generic address space. */ + return false; + } + /* Use precision rather then machine mode when we can, which gives the correct answer even for submode (bit-field) types. */ if ((INTEGRAL_TYPE_P (outer_type) |