From: Richard Hirst <rhirst@linuxcare.com>
To: Alan Modra <alan@linuxcare.com.au>
Cc: parisc-linux@thepuffingroup.com
Subject: [parisc-linux] hppa64 gcc sizeof() bug?
Date: Wed, 6 Dec 2000 11:52:03 +0000 [thread overview]
Message-ID: <20001206115203.Q7166@linuxcare.com> (raw)
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;
}
[rhirst@rhirst play]$ hppa64-linux-gcc -S -o tc.s -O2 tc.c
[rhirst@rhirst play]$ cat tc.s
.LEVEL 2.0w
gcc2_compiled.:
.text
.align 8
.globl sys32_get_kernel_syms
.type sys32_get_kernel_syms,@function
sys32_get_kernel_syms:
.PROC
.CALLINFO FRAME=128,CALLS,SAVE_RP,ENTRY_GR=6
.ENTRY
std %r2,-16(%r30)
ldo 128(%r30),%r30
std %r6,-128(%r30)
ldi 64,%r6 <<< Good, struct is 64 bytes
std %r5,-120(%r30)
ldi 0,%r5
std %r4,-112(%r30)
copy %r27,%r4
std %r3,-104(%r30)
copy %r26,%r3
.L3:
copy %r3,%r26
ldo 4096(%r3),%r3 <<< BAD struct is not 4096 bytes!
cmpb,<= %r6,%r5,.L4
ldo -16(%r30),%r29
b,l thing,%r2
nop
copy %r4,%r27
cmpib,= 0,%r28,.L5
ldo 1(%r5),%r19
.L4:
copy %r5,%r28
ldd -144(%r30),%r2
ldd -120(%r30),%r5
ldd -112(%r30),%r4
ldd -104(%r30),%r3
bve (%r2)
ldd,mb -128(%r30),%r6
.L5:
b .L3
extrd,s %r19,63,32,%r5
.EXIT
.PROCEND
.Lfe1:
.size sys32_get_kernel_syms,.Lfe1-sys32_get_kernel_syms
.ident "GCC: (GNU) 2.96 20000925 (experimental)"
[rhirst@rhirst play]$
next reply other threads:[~2000-12-06 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-06 11:52 Richard Hirst [this message]
2000-12-06 12:18 ` [parisc-linux] hppa64 gcc sizeof() bug? Richard Hirst
2000-12-06 18:28 ` Grant Grundler
2000-12-06 12:44 ` Richard Hirst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20001206115203.Q7166@linuxcare.com \
--to=rhirst@linuxcare.com \
--cc=alan@linuxcare.com.au \
--cc=parisc-linux@thepuffingroup.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.