public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
To: drow@false.org
Cc: gcc@gcc.gnu.org
Subject: Re: Problem with ARM_DOUBLEWORD_ALIGN on ARM
Date: Thu, 22 Nov 2007 08:00:00 -0000	[thread overview]
Message-ID: <10711212107.AA27608@vlsi1.ultra.nyu.edu> (raw)
In-Reply-To: <20071121210156.GA15755@caradoc.them.org>

> Do you have any test cases?  I'm pretty sure this works, at least in
> the usual cases.

They're going to be hard to construct since they are sensitive to such
things as the number of registers saved.

> A wild guess says that you're doing this in Ada.  It may be something
> specific to the nested case then.

It is in Ada, but I don't think the nested case is the cause of the
particular problem I ran into (it does need to be fixed anyway, though,
since it might bite later).  I suspect the case we're running into is
either the args to push or the registers saved.

Here's a description of the miscompilation we saw:

> Specifically, in Ada.Text_IO.Put_Line, we end up calling memcpy
> with a buffer allocated using "alloca". The alloca result
> is aligned to a multiple of 8, but the corresponding operation
> on the stack pointer is eliminated because combine assumes
> the stack is aligned already.
> 
> Specifically, in the example below, the assignment to
> Buffer (1 .. Ilen) is done through memcpy, but
> memcpy overwrites the return address.
> 
>  From a-textio.adb, around line 1450:
> 
>        --  Now prepare the string with its terminator
> 
>        declare
>           Buffer : String (1 .. Ilen + 2);
>           Plen   : size_t;
> 
>        begin
>           Buffer (1 .. Ilen) := Item (Istart .. Item'Last);
>           Buffer (Ilen + 1) := Character'Val (LM);

When you look at the disassembled code, we saw an update to the stack
pointer in the prologue of a number that wasn't a multiple of 8 (it
was 36, if I remember correctly).

  reply	other threads:[~2007-11-21 21:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-21 23:32 Richard Kenner
2007-11-22  7:22 ` Daniel Jacobowitz
2007-11-22  8:00   ` Richard Kenner [this message]
2007-11-22 15:30 Geert Bosch
2007-11-26 10:34 ` Daniel Jacobowitz
2007-12-26 20:05 ` Mark Mitchell
2007-12-26 22:44   ` Geert Bosch

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=10711212107.AA27608@vlsi1.ultra.nyu.edu \
    --to=kenner@vlsi1.ultra.nyu.edu \
    --cc=drow@false.org \
    --cc=gcc@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).