-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, Sep 29, 2005 at 09:35:22AM -0700, Richard Henderson wrote:
> On Thu, Sep 29, 2005 at 07:32:46AM -0400, Richard Kenner wrote:
> > The real fix is below, though I haven't run it throuh a testing
> > cycle yet. I was wondering how this ever worked:
>
> Indeed this is clearly correct. And one does wonder how this missing
> line has managed to not cause problems elsewhere...
At first I thought that my half-hearted effort at writing a port (16-bit
x86) was failing only due to my uber GCC cluelessness, then I saw just
the right number of statistically unlikely phrases in the patch to pique
my interest.
Since a few weeks ago, during the building of my target libgcc, I get:
/mnt/disk2/src/gcc/gcc/libgcc2.h:378: error: size of array '__popcount_tab' is
too large 1
(The '1' refers to the first of two identical warnings.)
So I learned about dump_node() and applied this patch:
- --- c-decl.c.borig Fri Sep 16 14:51:38 2005
+++ c-decl.c Thu Sep 29 17:05:49 2005
@@ -4109,20 +4109,25 @@ grokdeclarator (const struct c_declarato
{
tree itype = NULL_TREE;
tree size = declarator->u.array.dimen;
/* The index is a signed object `sizetype' bits wide. */
tree index_type = c_common_signed_type (sizetype);
array_ptr_quals = declarator->u.array.quals;
array_ptr_attrs = declarator->u.array.attrs;
array_parm_static = declarator->u.array.static_p;
+ fprintf(stderr, " **** sizetype: ****\n");
+ dump_node(sizetype, 0, stderr);
+ fprintf(stderr, " **** index_type: ****\n");
+ dump_node(index_type, 0, stderr);
+
declarator = declarator->declarator;
/* Check for some types that there cannot be arrays of. */
if (VOID_TYPE_P (type))
{
error ("declaration of %qs as array of voids", name);
type = error_mark_node;
}
The result is this:
**** sizetype: ****
@1 integer_type name: @2 size: @3 algn: 8
prec: 8 sign: unsigned min : @4
max : @5
@2 type_decl name: @6 type: @7 srcp:
<built-in>:0
@3 integer_cst type: @8 low : 8
@4 integer_cst type: @7 low : 0
@5 integer_cst type: @7 low : 255
@6 identifier_node strg: short unsigned int lngt: 18
@7 integer_type name: @2 size: @3 algn: 8
prec: 8 sign: unsigned min : @4
max : @5
@8 integer_type name: @9 size: @10 algn: 16
prec: 12 sign: unsigned min : @11
max : @12
@9 identifier_node strg: bit_size_type lngt: 13
@10 integer_cst type: @8 low : 16
@11 integer_cst type: @8 low : 0
@12 integer_cst type: @8 low : 4095
**** index_type: ****
@1 integer_type name: @2 size: @3 algn: 8
prec: 8 sign: signed min : @4
max : @5
@2 type_decl name: @6 type: @1 srcp:
<built-in>:0
@3 integer_cst type: @7 low : 8
@4 integer_cst type: @1 high: -1 low : -128
@5 integer_cst type: @1 low : 127
@6 identifier_node strg: signed char lngt: 11
@7 integer_type name: @8 size: @9 algn: 16
prec: 12 sign: unsigned min : @10
max : @11
@8 identifier_node strg: bit_size_type lngt: 13
@9 integer_cst type: @7 low : 16
@10 integer_cst type: @7 low : 0
@11 integer_cst type: @7 low : 4095
Does anyone know why index_type seems to be "signed char", which of
course cannot hold indices into __popcount_tab[256]?
[Sorry, no paperwork filed, therefore no show-and-tell to the list.]
- --
/"\ ASCII Ribbon Campaign - against html email
\ / - against microsoft office attachments
X - against text above fullquote below
/ \ - against lines longer than 79 characters
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Please fetch my new key 804177F8 from hkp://wwwkeys.eu.pgp.net/
Comment: My current key expires in two weeks, please ask for ID checks now.
iD8DBQFDPU6R/FmLrNfLpjMRAmVoAJ9d1vHM4tcYAw+dMSuHJt/Pa6TGuwCfeAJs
K6VF/6OS+QnbdRcvGXZZSn4=
=F2Lc
-----END PGP SIGNATURE-----