Found one (the?) ARM bug: (Pointer) aliasing issues
Iain Buclaw
ibuclaw at ubuntu.com
Thu Nov 7 08:14:59 PST 2013
On 3 November 2013 10:20, Johannes Pfau <nospam at example.com> wrote:
> Am Sun, 3 Nov 2013 02:10:20 +0000
> schrieb Iain Buclaw <ibuclaw at ubuntu.com>:
>
> > last time I
> > checked, returning 0 disables aliasing rules from taking effect.
>
> That should work. Alias set 0 is a special alias set which conflicts
> with everything. I'll check if it works as expected.
>
This is taken from hunks in the 2.064 merge I'm testing:
Pastebin link here: http://pastebin.com/jxQQL68N
diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc
index 8cba369..a19a59b 100644
--- a/gcc/d/d-lang.cc
+++ b/gcc/d/d-lang.cc
@@ -73,6 +73,7 @@ const attribute_spec d_attribute_table[] =
#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
#undef LANG_HOOKS_ATTRIBUTE_TABLE
#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
+#undef LANG_HOOKS_GET_ALIAS_SET
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
#undef LANG_HOOKS_BUILTIN_FUNCTION
#undef LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE
@@ -95,6 +96,7 @@ const attribute_spec d_attribute_table[] =
#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE d_builtins_attribute_table
#define LANG_HOOKS_ATTRIBUTE_TABLE d_attribute_table
#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE d_format_attribute_table
+#define LANG_HOOKS_GET_ALIAS_SET d_get_alias_set
#define LANG_HOOKS_TYPES_COMPATIBLE_P d_types_compatible_p
#define LANG_HOOKS_BUILTIN_FUNCTION d_builtin_function
#define LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE d_builtin_function
@@ -1505,6 +1523,33 @@ d_getdecls (void)
}
+// 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)
{
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20131107/00ee6824/attachment.html>
More information about the D.gnu
mailing list