This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR c/27184: bad alias sets for incomplete array types

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 
<>, so it should be 
safe to remove it.

Joseph S. Myers      (personal mail) (CodeSourcery mail) (Bugzilla assignments and CCs)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]