This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/6392: [PATCH] Problems with __restrict__ type qualifier(array)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-bugs at gcc dot gnu dot org, Daniel Berlin <dberlin at dberlin dot org>
- Cc: schmid at snake dot iap dot physik dot tu-darmstadt dot de, gcc-gnats at gcc dot gnu dot org,gcc-patches at gcc dot gnu dot org
- Date: Fri, 03 May 2002 17:21:16 +0100
- Subject: Re: c++/6392: [PATCH] Problems with __restrict__ type qualifier(array)
- References: <20020503161139.3065.qmail@sources.redhat.com>
This seems like the right fix; there's no reason to apply the bizarre
array cv-qual handling to restrict.
Tested i686-pc-linux-gnu, applied trunk only. I put Daniel's test in
g++.dg/template/restrict1.C.
2002-05-03 Jason Merrill <jason@redhat.com>
* tree.c (build_cplus_array_type): Only const and volatile get
special handling.
*** tree.c.~1~ Fri May 3 13:15:44 2002
--- tree.c Thu May 2 17:01:44 2002
*************** build_cplus_array_type (elt_type, index_
*** 495,508 ****
{
tree t;
int type_quals = cp_type_quals (elt_type);
! if (type_quals != TYPE_UNQUALIFIED)
! elt_type = cp_build_qualified_type (elt_type, TYPE_UNQUALIFIED);
t = build_cplus_array_type_1 (elt_type, index_type);
! if (type_quals != TYPE_UNQUALIFIED)
! t = cp_build_qualified_type (t, type_quals);
return t;
}
--- 495,510 ----
{
tree t;
int type_quals = cp_type_quals (elt_type);
+ int cv_quals = type_quals & (TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
+ int other_quals = type_quals & ~(TYPE_QUAL_CONST|TYPE_QUAL_VOLATILE);
! if (cv_quals)
! elt_type = cp_build_qualified_type (elt_type, other_quals);
t = build_cplus_array_type_1 (elt_type, index_type);
! if (cv_quals)
! t = cp_build_qualified_type (t, cv_quals);
return t;
}