summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authordgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-12 11:47:56 +0000
committerdgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-12 11:47:56 +0000
commit5bfe6313be46eb5f3355345dddb5df965cb28104 (patch)
tree88963ed1125aa1dd825676f3893fc6db6c464dd5 /gcc
parenta128a28fc63546687581d693ab90296646823661 (diff)
downloadgcc-5bfe6313be46eb5f3355345dddb5df965cb28104.tar.gz
2007-04-12 Douglas Gregor <doug.gregor@gmail.com>
PR c++/31078 PR c++/31103 * c-common.c (c_build_qualified_type): Set canonical type appropriately. 2007-04-12 Douglas Gregor <doug.gregor@gmail.com> PR c++/31078 * g++.dg/other/pr31078.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123740 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-common.c18
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/pr31078.C31
4 files changed, 61 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 823b5a38b18..7349b7787cd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-12 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/31078
+ PR c++/31103
+ * c-common.c (c_build_qualified_type): Set canonical type
+ appropriately.
+
2007-04-12 Richard Guenther <rguenther@suse.de>
* tree-pretty-print.c (dump_generic_node): Print ARRAY_REF
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 8f71e6916ed..761a9b44acf 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2894,8 +2894,26 @@ c_build_qualified_type (tree type, int type_quals)
}
if (!t)
{
+ tree domain = TYPE_DOMAIN (type);
+
t = build_variant_type_copy (type);
TREE_TYPE (t) = element_type;
+
+ if (TYPE_STRUCTURAL_EQUALITY_P (element_type)
+ || (domain && TYPE_STRUCTURAL_EQUALITY_P (domain)))
+ SET_TYPE_STRUCTURAL_EQUALITY (t);
+ else if (TYPE_CANONICAL (element_type) != element_type
+ || (domain && TYPE_CANONICAL (domain) != domain))
+ {
+ tree unqualified_canon
+ = build_array_type (TYPE_CANONICAL (element_type),
+ domain? TYPE_CANONICAL (domain)
+ : NULL_TREE);
+ TYPE_CANONICAL (t)
+ = c_build_qualified_type (unqualified_canon, type_quals);
+ }
+ else
+ TYPE_CANONICAL (t) = t;
}
return t;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c5cf4f6a13e..aa7e3e29a57 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-12 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/31078
+ * g++.dg/other/pr31078.C: New.
+
2007-04-12 Richard Guenther <rguenther@suse.de>
PR tree-optimization/31169
diff --git a/gcc/testsuite/g++.dg/other/pr31078.C b/gcc/testsuite/g++.dg/other/pr31078.C
new file mode 100644
index 00000000000..7f610713084
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr31078.C
@@ -0,0 +1,31 @@
+typedef int SLONG;
+typedef char SCHAR;
+typedef short SSHORT;
+typedef char TEXT;
+typedef long ISC_STATUS;
+const SLONG gds_arg_string = 2;
+const SLONG gds_sys_request = 335544373L;
+enum jrd_blk_t
+{
+ type_str, type_dcc, type_sbm, type_smb, type_blb, type_irb, type_jrn
+};
+struct blk
+{
+};
+template < class RPT, SSHORT BLOCK_TYPE = 0 > class pool_alloc_rpt:public blk
+{
+};
+class jrn:public pool_alloc_rpt < SCHAR, type_jrn >
+{
+public:ISC_STATUS * jrn_status_vector;
+ TEXT jrn_server[1];
+};
+typedef jrn *JRN;
+extern void IBERR_build_status (ISC_STATUS *, ISC_STATUS, ...);
+static void
+error (ISC_STATUS * status_vector, JRN journal, int status, TEXT * string)
+{
+ IBERR_build_status (status_vector, gds_sys_request, gds_arg_string, string,
+ gds_arg_string, (journal) ? journal->jrn_server : "",
+ 0);
+}