public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/61954] Ada fails to properly pass pointer arguments on x32
Date: Wed, 30 Jul 2014 00:18:00 -0000	[thread overview]
Message-ID: <bug-61954-4-zcnlutWhTs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61954-4@http.gcc.gnu.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.


  reply	other threads:[~2014-07-30  0:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 16:23 [Bug ada/61954] New: " hjl.tools at gmail dot com
2014-07-30  0:18 ` hjl.tools at gmail dot com [this message]
2014-07-30  0:34 ` [Bug ada/61954] " hjl.tools at gmail dot com
2014-07-30 16:03 ` hjl.tools at gmail dot com
2014-08-06 16:30 ` ebotcazou at gcc dot gnu.org

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=bug-61954-4-zcnlutWhTs@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).