public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PRs c++/31078 and c++/31103 (canonical types failures)
@ 2007-04-05 17:41 Doug Gregor
  2007-04-05 19:42 ` [patch] Vectorizer cost model implementation Linthicum, Tony
  2007-04-12  3:37 ` [PATCH] Fix PRs c++/31078 and c++/31103 (canonical types failures) Mark Mitchell
  0 siblings, 2 replies; 30+ messages in thread
From: Doug Gregor @ 2007-04-05 17:41 UTC (permalink / raw)
  To: GCC Patches

This patch fixes two PRs related to failures in the canonical types
system, both with the same cause. In the original canonical types
patch, I failed to update TYPE_CANONICAL in c_build_qualified_type.
Thus, the canonical type system sometimes considered two array types
identical when their elements types actually had different cv
qualifiers. This didn't cause a huge number of failures because the
C++ front end only directly calls cp_build_qualified_type and
build_array_type, both of which already set canonical types properly.
PR 31078 got to c_build_qualified_type through fix_string_type, for
example, so the issue shows up with the type of a string literal.

This clears up the two PRs listed. Regtesting on
i386-apple-darwin8.8.1. Assuming no regressions, okay to commit to
mainline?

:ADDPATCH c/c++:

  - Doug

2007-04-05  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-05  Douglas Gregor  <doug.gregor@gmail.com>

	* g++.dg/other/pr31078.C: New.

Index: testsuite/g++.dg/other/pr31078.C
===================================================================
--- testsuite/g++.dg/other/pr31078.C	(revision 0)
+++ testsuite/g++.dg/other/pr31078.C	(revision 0)
@@ -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);
+}
Index: c-common.c
===================================================================
--- c-common.c	(revision 123513)
+++ c-common.c	(working copy)
@@ -2894,8 +2894,26 @@ c_build_qualified_type (tree type, int t
 	}
       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;
     }

^ permalink raw reply	[flat|nested] 30+ messages in thread
[parent not found: <D5B24B5251882048AD03DDFA431BB790012F002E@SAUSEXMB3.amd.com>]
[parent not found: <D5B24B5251882048AD03DDFA431BB790012F0031@SAUSEXMB3.amd.com>]

end of thread, other threads:[~2007-06-08 19:13 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-05 17:41 [PATCH] Fix PRs c++/31078 and c++/31103 (canonical types failures) Doug Gregor
2007-04-05 19:42 ` [patch] Vectorizer cost model implementation Linthicum, Tony
2007-04-05 19:54   ` Steven Bosscher
2007-04-05 20:06     ` Linthicum, Tony
2007-04-05 21:35   ` Eric Christopher
2007-04-06  0:24   ` Sebastian Pop
2007-04-06 15:41     ` Jagasia, Harsha
2007-04-08 13:24     ` Dorit Nuzman
2007-04-08 14:37   ` Dorit Nuzman
2007-04-11 21:25     ` Jagasia, Harsha
2007-04-22  5:45     ` Jagasia, Harsha
2007-04-22  6:23       ` Andrew Pinski
2007-04-22  9:09         ` Eric Christopher
2007-04-22 15:57       ` Paul Brook
2007-04-22 22:39       ` Dorit Nuzman
2007-04-24 20:14         ` Jagasia, Harsha
2007-04-25 11:49           ` Dorit Nuzman
2007-04-25 15:37             ` Jagasia, Harsha
2007-06-06 16:36             ` Jagasia, Harsha
2007-06-07  2:09               ` Eric Christopher
2007-06-07 19:55               ` Dorit Nuzman
2007-06-07 20:11                 ` Jagasia, Harsha
2007-06-08 19:21                 ` [patch] Vectorizer cost model implementation : committed Jagasia, Harsha
2007-04-12  3:37 ` [PATCH] Fix PRs c++/31078 and c++/31103 (canonical types failures) Mark Mitchell
     [not found] <D5B24B5251882048AD03DDFA431BB790012F002E@SAUSEXMB3.amd.com>
2007-04-05 20:38 ` [patch] Vectorizer cost model implementation Jagasia, Harsha
2007-04-08 13:19   ` Dorit Nuzman
     [not found] <D5B24B5251882048AD03DDFA431BB790012F0031@SAUSEXMB3.amd.com>
2007-04-05 22:26 ` Jagasia, Harsha
2007-04-05 22:29   ` Eric Christopher
2007-04-05 22:31     ` Jagasia, Harsha
2007-04-08 13:23   ` Dorit Nuzman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).