public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@markmitchell.com>
To: wilson@cygnus.com
Cc: egcs@cygnus.com, wilson@cygnus.com
Subject: Re: aliasing problem with va_arg
Date: Tue, 27 Oct 1998 16:33:00 -0000	[thread overview]
Message-ID: <199810271944.LAA17956@smtp.earthlink.net> (raw)
In-Reply-To: <199810271907.LAA04580@rtl.cygnus.com>

>>>>> "Jim" == Jim Wilson <wilson@cygnus.com> writes:

    Jim> The sparc ABI does not align double-word arguments to a
    Jim> double-word boundary.  The sparc ldd instruction requires
    Jim> double-word alignment.  Thus we can't use an ldd instruction

Thanks.  That explains why the macro was doing what it was.  One other
ANSI C solution to this problem is to use `memcpy'.  Obviously, the
performance of even the builtin memcpy may not be ideal, especially if
it can't figure out that the storage will be word-aligned.

But, the short answer will be that this oddity of the SPARC ABI makes
efficient va_arg macros that are compliant ISO C just about
impossible; you can't access the memory with the type that it really
has, so you can only use `char'.  I suppose inline assembly is another
option.

I suggest that you proceed with your partially implemented
__builtin_va_arg support.  I think that your assertion that all 30
ports will have to be changed is false; only those with non-compliant
va_arg macros need to be changed.  It doesn't look to me like the MIPS
port does the same kind of trickery as the SPARC port, so I don't see
(at first glance) that it's va_arg macros will cause problems.

It looks like the PA port also does something odd with va_arg
involving treating a `char*' as an `int*' so it too probably needs
fixing.  I suggest that we finish up the machine-independent builtin
support, which seems better than doing other weird hacks because it
can't really be that hard and is something we know we want to do, and
then provide the machine-dependent implementations for it on the PA
and SPARC ports, if the PA macros cannot be fixed.

At that point we can also remove the bits in alias.c that disable
alias analysis for varargs functions.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

  reply	other threads:[~1998-10-27 16:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-23 17:45 Jim Wilson
1998-10-23 18:12 ` Mark Mitchell
1998-10-26 20:42   ` Jim Wilson
1998-10-27  3:02     ` Mark Mitchell
1998-10-27 14:55       ` Jim Wilson
1998-10-27 16:33         ` Mark Mitchell [this message]
1998-10-28 12:45           ` Jim Wilson
1998-10-27 16:33       ` Jim Wilson
     [not found]       ` <199810271907.LAA04580.cygnus.egcs@rtl.cygnus.com>
1998-10-28  1:58         ` Jason Merrill
1998-10-29  0:50           ` Jim Wilson
1998-10-29  0:50             ` Mark Mitchell
1998-10-30  2:40               ` Jim Wilson
1998-10-27 16:33     ` Jeffrey A Law
1998-10-28  6:43       ` Andi Kleen
1998-10-28 12:45         ` Jeffrey A Law

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=199810271944.LAA17956@smtp.earthlink.net \
    --to=mark@markmitchell.com \
    --cc=egcs@cygnus.com \
    --cc=wilson@cygnus.com \
    /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).