This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

bugs call __alloca


thanks for great project.:-

i could not compile. who was wrong? the source is..

#include <windows.h>
#include <stdio.h>

char *gptr;

void char1(char *ptr)
{
  printf("ptr = %08p gptr = %08p\n", ptr, gptr);
}

void __attribute__ ((regparm(3)))  char2(char *ptr)
{
  printf("ptr = %08p gptr = %08p\n", ptr, gptr);
}

void __attribute__ ((regparm(3)))  char3(char *ptr)
{
  char buf[0x8000]; // call __alloca does destroy some register (and ptr)
  printf("ptr = %08p gptr = %08p\n", ptr, gptr);
  buf[0] = '1';
}

void char4(char *ptr)
{
  char buf[0x8000];
  printf("ptr = %08p gptr = %08p\n", ptr, gptr);
  buf[0] = '2';
}

int main(int argc, char **argv[])
{
  char buf[100];
  gptr = buf;
  char1(buf);
  char2(buf);
  char3(buf);
  char4(buf);
  return 0;
}

ptr = 0253FDB0 gptr = 0253FDB0
ptr = 0253FDB0 gptr = 0253FDB0
ptr = 00401205 gptr = 0253FDB0 << ???
ptr = 0253FDB0 gptr = 0253FDB0

one idea is..
| push   32768
| call __allocapop

e_cygwin.bat is...
| @echo off
| apath -1 D:\CC\cygnus\cygwin-b20\H-i586-cygwin32\bin
| SET HOME=D:\CC\CYGNUS\USR
| SET SHELL=D:\CC\CYGNUS\BIN\SH.EXE
| SET ROOT=D:\
| SET MAKE_MODE=UNIX
| SET CYGWIN=notty binmode notitle nostrip_title glob envcache
| SET CYGINCLUDE=d:\cc\cygnus\cygwin~1\h-i586~1\i586-c~1\include
| SET CYGLIB=d:\cc\cygnus\cygwin~1\h-i586~1\i586-c~1\lib
| SET GCC_EXEC_PREFIX=D:\cc\cygnus\cygwin-b20\H-5386-cygwin32\lib\gcc-lib\
| SET TCL_LIBRARY=d:/cc/cygnus/cygwin-b20/tcl/lib/tcl7.6
| SET GDBTK_LIBRARY=d:/cc/cygnus/cygwin-b20/share/gdbtcl


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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