aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog8
-rw-r--r--gcc/c/c-objc-common.c19
-rw-r--r--gcc/c/c-objc-common.h2
-rw-r--r--gcc/c/c-tree.h1
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index fc8049e..076a9a2 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,11 @@
+2019-04-01 Richard Biener <rguenther@suse.de>
+
+ PR c/71598
+ * c-tree.h (c_get_alias_set): Declare.
+ * c-objc-common.h (LANG_HOOKS_GET_ALIAS_SET): Use c_get_alias_set.
+ * c-objc-common.c (c_get_alias_set): Treat enumeral types
+ as the underlying integer type.
+
2019-03-19 Martin Sebor <msebor@redhat.com>
PR tree-optimization/89688
diff --git a/gcc/c/c-objc-common.c b/gcc/c/c-objc-common.c
index 21ca7e6..2b76737 100644
--- a/gcc/c/c-objc-common.c
+++ b/gcc/c/c-objc-common.c
@@ -265,3 +265,22 @@ c_vla_unspec_p (tree x, tree fn ATTRIBUTE_UNUSED)
{
return c_vla_type_p (x);
}
+
+/* Special routine to get the alias set of T for C. */
+
+alias_set_type
+c_get_alias_set (tree t)
+{
+ /* Allow aliasing between enumeral types and the underlying
+ integer type. This is required since those are compatible types. */
+ if (TREE_CODE (t) == ENUMERAL_TYPE)
+ {
+ tree t1 = c_common_type_for_size (tree_to_uhwi (TYPE_SIZE (t)),
+ /* short-cut commoning to signed
+ type. */
+ false);
+ return get_alias_set (t1);
+ }
+
+ return c_common_get_alias_set (t);
+}
diff --git a/gcc/c/c-objc-common.h b/gcc/c/c-objc-common.h
index 7a90c77..f5e8204 100644
--- a/gcc/c/c-objc-common.h
+++ b/gcc/c/c-objc-common.h
@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see
#undef LANG_HOOKS_POST_OPTIONS
#define LANG_HOOKS_POST_OPTIONS c_common_post_options
#undef LANG_HOOKS_GET_ALIAS_SET
-#define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
+#define LANG_HOOKS_GET_ALIAS_SET c_get_alias_set
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE c_common_parse_file
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index d6e345a..9393f6d 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -623,6 +623,7 @@ extern bool c_missing_noreturn_ok_p (tree);
extern bool c_warn_unused_global_decl (const_tree);
extern void c_initialize_diagnostics (diagnostic_context *);
extern bool c_vla_unspec_p (tree x, tree fn);
+extern alias_set_type c_get_alias_set (tree);
/* in c-typeck.c */
extern int in_alignof;