summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c
new file mode 100644
index 00000000000..b4b1a819ff4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030729-1.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-dom3" } */
+
+union tree_node;
+typedef union tree_node *tree;
+
+
+enum tree_code
+{
+ SET_TYPE,
+ RECORD_TYPE,
+ LAST_AND_UNUSED_TREE_CODE
+};
+extern const char tree_code_type[];
+
+struct tree_common
+{
+
+ enum tree_code code:8;
+};
+
+
+
+
+
+union tree_node
+{
+ struct tree_common common;
+};
+
+readonly_fields_p (type)
+ tree type;
+{
+
+ if (type->common.code != RECORD_TYPE)
+ return;
+
+ if (tree_code_type[type->common.code] != 't')
+ abort ();
+
+ return;
+}
+
+/* A good optimizer would realize that the cast to (unsigned int) is
+ useless as the earlier cast of the same value of (unsigned char) will
+ always produce the same result. */
+/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 0 "dom3"} } */
+
+/* There should be one load of ->common.code. We currently fail this
+ because we load from ->common.code using different types. */
+/* { dg-final { scan-tree-dump-times "common\.code" 1 "dom3"} } */