This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/61954] Ada fails to properly pass pointer arguments on x32
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Jul 2014 00:18:18 +0000
- Subject: [Bug ada/61954] Ada fails to properly pass pointer arguments on x32
- Auto-submitted: auto-generated
- References: <bug-61954-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61954
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Ada seems to use a struct for pointers, something
like
struct pointer
{
void *p;
void *b;
};
But it fails to properly zero-extend pointers when calling
C functions:
[hjl@gnu-6 tmp]$ cat p.c
struct pointer
{
void *p;
void *b;
};
extern void foo (struct pointer);
extern void bar (void *p);
void
xxx (struct pointer p)
{
foo (p);
}
void
yyy (struct pointer p)
{
bar (p.p);
}
[hjl@gnu-6 tmp]$ gcc -mx32 -O2 p.c -S
[hjl@gnu-6 tmp]$ cat p.s
.file "p.c"
.text
.p2align 4,,15
.globl xxx
.type xxx, @function
xxx:
.LFB0:
.cfi_startproc
jmp foo
.cfi_endproc
.LFE0:
.size xxx, .-xxx
.p2align 4,,15
.globl yyy
.type yyy, @function
yyy:
.LFB1:
.cfi_startproc
movl %edi, %edi
jmp bar
.cfi_endproc
.LFE1:
.size yyy, .-yyy
It treats C functions, like
ssize_t write(int fd, const void *buf, size_t count);
as Ada functions.