This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/61954] Ada fails to properly pass pointer arguments on x32


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]