[parisc-linux] hppa64 gcc sizeof() bug?

Richard Hirst rhirst@linuxcare.com
Wed, 6 Dec 2000 12:18:55 +0000


On Wed, Dec 06, 2000 at 11:52:03AM +0000, Richard Hirst wrote:
> Hi Alan,
>   The following shows the compiler getting confused over the size
> of a struct.  This is with a gcc/binutils built since the last
> fix you did for me.
> 
> Richard
> 
> 
> [rhirst@rhirst play]$ cat tc.c
> 
> 
> typedef unsigned int u32;
> #define NULL ((void *)0)
> 
> struct kernel_sym32 {
>         u32 value;
>         char name[60];
> };
> 
> extern int sys_get_kernel_syms(void *);
> extern int thing(struct kernel_sym32 *table);
> 
> int sys32_get_kernel_syms(struct kernel_sym32 *table)
> {
>         int len, i;
> 
>         len = sizeof (struct kernel_sym32);
>         for (i = 0; i < len; i++, table += sizeof (struct kernel_sym32)) {
>                 if (thing(table))
>                         break;
>         }
>         return i;
> }

Just changed it to 'table += 64' and it still generates code that
adds 4096, so sizeof is not relevant.

Richard