From: Kai Tietz <Kai.Tietz@onevision.com>
To: gcc@gcc.gnu.org
Cc: Jan Hubicka <jh@suse.cz>,
ktietz70@googlemail.com,
"Uros Bizjak" <ubizjak@gmail.com>
Subject: Re: Still problems with alloca and frame layout on w64 targets
Date: Tue, 27 May 2008 15:02:00 -0000 [thread overview]
Message-ID: <OF4630B868.851F0692-ONC1257456.00528009-C1257456.00529A92@onevision.de> (raw)
In-Reply-To: <OF343884BC.56C110BB-ONC1257456.00511AE4-C1257456.00524A70@onevision.de>
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
> Hi,
>
> this small c program produces wrong code on x86_64-pc-mingw32. The
problem
> here is the call abi w64. For w64 call abi, the last reserved 32 bytes
on
> stack are use for vaarg functions to save the incoming arguments from
> register. This works fine as long as there is no alloca call within the
> function calling a vaarg method. The alloca reserves just the stack, but
> does not move the stack clobber region. So by a vaarg call the last
> reserved stack is clobbered.
>
> How and where can I solve this problem?
Sorry I attached wrong testcase
Thanks in advance,
Kai
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
[-- Attachment #2: test.c --]
[-- Type: application/octet-stream, Size: 616 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <stdarg.h>
void do_zero (int argc, ...)
{
va_list argp;
char *c;
va_start(argp, argc);
while ((c=va_arg(argp,char *))!=NULL)
memset(c,0,argc);
va_end (argp);
}
void do_print (const char *fmt, const char *h,int s)
{
int i;
for (i=0;h[i]==0 && i<s;i++);
if (i!=s) abort ();
}
int main (int argc,char **argv)
{
char *a,*b;
a = (char *) alloca (argc * 32);
do_zero (argc * 32,a,NULL);
b = (char *) alloca (argc * 32);
do_zero (argc * 32,b,NULL);
do_print ("a",a,argc * 32);
do_print ("a",b,argc * 32);
return 0;
}
prev parent reply other threads:[~2008-05-27 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-27 14:59 Kai Tietz
2008-05-27 15:02 ` Kai Tietz [this message]
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=OF4630B868.851F0692-ONC1257456.00528009-C1257456.00529A92@onevision.de \
--to=kai.tietz@onevision.com \
--cc=gcc@gcc.gnu.org \
--cc=jh@suse.cz \
--cc=ktietz70@googlemail.com \
--cc=ubizjak@gmail.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).