aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-01-03 01:54:40 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-01-03 01:54:40 +0100
commit493aa551b29a64091d07e3a0736b5cd3b84e94a4 (patch)
tree9c32c8623b462e75703ad770a137a1eaeba5e765 /gcc/builtins.c
parent5f26a23027acae2712001616c4b13c76cf316cd5 (diff)
downloadgcc-493aa551b29a64091d07e3a0736b5cd3b84e94a4.zip
gcc-493aa551b29a64091d07e3a0736b5cd3b84e94a4.tar.gz
gcc-493aa551b29a64091d07e3a0736b5cd3b84e94a4.tar.bz2
re PR c++/38705 (ICE: canonical types differ for identical types const int and const AlpsNodeIndex_t)
PR c++/38705 * builtins.c (fold_builtin_memory_op): Give up if either operand is volatile. Set srctype or desttype to non-qualified version of the other type. * g++.dg/torture/pr38705.C: New test. From-SVN: r143029
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index cda94c3..57cce08 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -8907,7 +8907,9 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
|| !TYPE_SIZE_UNIT (srctype)
|| !TYPE_SIZE_UNIT (desttype)
|| TREE_CODE (TYPE_SIZE_UNIT (srctype)) != INTEGER_CST
- || TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST)
+ || TREE_CODE (TYPE_SIZE_UNIT (desttype)) != INTEGER_CST
+ || TYPE_VOLATILE (srctype)
+ || TYPE_VOLATILE (desttype))
return NULL_TREE;
src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
@@ -8924,7 +8926,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
{
srcvar = build_fold_indirect_ref (src);
if (TREE_THIS_VOLATILE (srcvar))
- srcvar = NULL_TREE;
+ return NULL_TREE;
else if (!tree_int_cst_equal (lang_hooks.expr_size (srcvar), len))
srcvar = NULL_TREE;
/* With memcpy, it is possible to bypass aliasing rules, so without
@@ -8942,7 +8944,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
{
destvar = build_fold_indirect_ref (dest);
if (TREE_THIS_VOLATILE (destvar))
- destvar = NULL_TREE;
+ return NULL_TREE;
else if (!tree_int_cst_equal (lang_hooks.expr_size (destvar), len))
destvar = NULL_TREE;
else if (!var_decl_component_p (destvar))
@@ -8958,7 +8960,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
if (TREE_ADDRESSABLE (TREE_TYPE (destvar)))
return NULL_TREE;
- srctype = desttype;
+ srctype = build_qualified_type (desttype, 0);
if (src_align < (int) TYPE_ALIGN (srctype))
{
if (AGGREGATE_TYPE_P (srctype)
@@ -8980,7 +8982,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
if (TREE_ADDRESSABLE (TREE_TYPE (srcvar)))
return NULL_TREE;
- desttype = srctype;
+ desttype = build_qualified_type (srctype, 0);
if (dest_align < (int) TYPE_ALIGN (desttype))
{
if (AGGREGATE_TYPE_P (desttype)