+// Get the alias set corresponding to a type or expression. +// Return -1 if we don't do anything special. + +static alias_set_type +d_get_alias_set (tree t)
+{ + if (!TYPE_P (t)) + return get_alias_set (TREE_TYPE (t)); + + Type *dtype = build_dtype (t); + + // If the type is a dynamic array, use the alias set of the basetype. + if (dtype && dtype->ty == Tarray)
+ return get_alias_set (dtype->nextOf()->toCtype()); + + // Permit type-punning when accessing a union, provided the access + // is directly through the union. + for (tree u = t; handled_component_p (u); u = TREE_OPERAND (u, 0))
+ { + if (TREE_CODE (u) == COMPONENT_REF + && TREE_CODE (TREE_TYPE (TREE_OPERAND (u, 0))) == UNION_TYPE) + return 0; + } + + return -1; +} + static int d_types_compatible_p (tree t1, tree t2)
{