PATCH: type attributes influence other types
Andrew Haley
aph@pasanda.cygnus.co.uk
Tue Sep 7 09:41:00 GMT 1999
> Date: Tue, 7 Sep 99 11:46:36 EDT
> From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
>
> In testing I discovered that when compiling builtin functions gcc
> assumes that alignment is *not* part of a function's type. Here is an
> amended patch.
>
> Well that's true, but I'd think that if two function types had
> different TYPE_ALIGN values, something odd were going on. Can you say
> more about this?
It's because build_function_type() does this:
t = type_hash_canon (hashcode, t);
if (TYPE_SIZE (t) == 0)
layout_type (t);
Now, when a builtin is first defined, build_function_type() is called,
which calls type_hash_canon() which installs the builtin's type in the
hash table. Later on when the front end parses a call to a builtin,
it calls build_function_type(), which calls type_hash_canon(), which
uses type_hash_lookup() to see if the type is already in the hash
table. It does this *before* calling layout_type(), so the alignment
field of the function's type hasn't been set, so type_hash_lookup()
fails.
I suppose that we could solve this by ensuring that layout_type() is
always called before type_hash_lookup() ?
Andrew.
More information about the Gcc-patches
mailing list