[Bug ada/61954] Ada fails to properly pass pointer arguments on x32
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 30 00:18:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list