This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH] Fix endless recursion in make_vector_type (PR tree-opt/29637; 4.[0123] regression cause by PR c/29092 fix)


Roger Sayle wrote:
Hi Jakub,

On Sun, 29 Oct 2006, Jakub Jelinek wrote:
2006-10-29 Jakub Jelinek <jakub@redhat.com>

	PR tree-optimization/29637
	* tree.c (make_vector_type): Don't recurse if TYPE_MAIN_VARIANT
	of the innertype is the innertype itself.

* gcc.dg/pr29637.c: New test.

Sorry for the inconvenience. This is OK for all active branches. Whilst it isn't clear whether it'd be nice to always have a type without attributes to the be the TYPE_MAIN_VARIANT, this change is always safe, and resovles the regression.

I don't believe that invariant should hold, i.e., I think it reasonable for the TYPE_MAIN_VARIANT to have attributes.


Following the proposed (and, apparently, generally agreeable) semantics for attributes, something like:

typedef __attribute__((...)) int I;

makes "I" an entirely separate type from "int" if the attribute is "semantic". Then, TYPE_MAIN_VARIANT of "const I" would be "I", but not "int", and there is in general no non-attribute form of "I" that is "the same type".

The question, I suppose, is what TYPE_MAIN_VARIANT means. What it should mean (i.e., the way in which the compiler generally uses it at present) is "a type like this one, but without top-level qualifiers, and ignoring typedefs".

(Two types are the same if -- but *not* only if -- they have the same top-level qualifiers and their TYPE_MAIN_VARIANTS are the same. The "not only if" comes from things like two incomplete array types, which then turn out to have the same number of elements.)

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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