diff options
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 1af2120..e93d2fb 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1242,8 +1242,13 @@ warn_logical_operator (enum tree_code code, tree arg1, tree bool strict_aliasing_warning (tree otype, tree type, tree expr) { - if (!(flag_strict_aliasing && POINTER_TYPE_P (type) - && POINTER_TYPE_P (otype) && !VOID_TYPE_P (TREE_TYPE (type)))) + if (!(flag_strict_aliasing + && POINTER_TYPE_P (type) + && POINTER_TYPE_P (otype) + && !VOID_TYPE_P (TREE_TYPE (type))) + /* If the type we are casting to is a ref-all pointer + dereferencing it is always valid. */ + || TYPE_REF_CAN_ALIAS_ALL (type)) return false; if ((warn_strict_aliasing > 1) && TREE_CODE (expr) == ADDR_EXPR @@ -3464,10 +3469,6 @@ c_common_get_alias_set (tree t) || t == unsigned_char_type_node) return 0; - /* If it has the may_alias attribute, it can alias anything. */ - if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (t))) - return 0; - /* The C standard specifically allows aliasing between signed and unsigned variants of the same type. We treat the signed variant as canonical. */ |