This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c/27184: bad alias sets for incomplete array types
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 1 Jun 2006 21:31:04 +0000 (UTC)
- Subject: Re: PR c/27184: bad alias sets for incomplete array types
- References: <orpshwgj4b.fsf@free.oliva.athome.lsd.ic.unicamp.br>
On Tue, 30 May 2006, Alexandre Oliva wrote:
> The testcase included in the patch below fails at -O2 because the
> pointers to arrays with unknown bounds are regarded as unrelated
> types. That's because incomplete array types were not unified by
> build_array_type, presumably to avoid modifying shared types if/when
> such incomplete array types get completed, even though there was only
> one case that set TYPE_DOMAIN without avoiding modifying shared array
> types. Other languages didn't seem to be affected, and the testsuite
> results supported this impression.
It looks to me like
* tree.c (build_array_type): Unify array types with
unspecified index_type.
will render ineffective the code in c-decl.c:grokdeclarator
/* Detect the case of an array type of unspecified size
which came, as such, direct from a typedef name.
We must copy the type, so that each identifier gets
a distinct type, so that each identifier's size can be
controlled separately by its own initializer. */
if (type != 0 && typedef_type != 0
&& TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0
&& TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type))
{
type = build_array_type (TREE_TYPE (type), 0);
if (size_varies)
C_TYPE_VARIABLE_SIZE (type) = 1;
}
but I think this code has not been needed since
<http://gcc.gnu.org/ml/gcc-patches/2005-03/msg02661.html>, so it should be
safe to remove it.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)