This is the mail archive of the cygwin 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]
Other format: [Raw text]

gcc -mno-cygwin foo.c & gcc foo.c generate different behavior


====================
Windows 2000
CYGWIN_NT-5.0 1.5.10-3 (0.116/4/2)
gcc (GCC) 3.3.1 (cygming special)
====================



------ foo.c ------

#include <stdio.h>

struct foo
{
  char* bar_;
};

int main()
{
char* ch = "ABC";
struct foo* f;

  f->bar_ = ch;  /* gcc foo.c : Segmentation fault */
  printf("start\n");
  printf("---> %s\n", f->bar_);
  printf("finish\n");

  return 0;

}

-------------------

$ gcc -mno-cygwin foo.c

$ a
start
---> ABC
finish

$ cygcheck a
Found: .\a.exe
a.exe
  C:\WINNT\system32\msvcrt.dll
    C:\WINNT\system32\KERNEL32.dll
      C:\WINNT\system32\NTDLL.DLL


$ gcc foo.c

$ a
Segmentation fault (core dumped)

$ cygcheck a
Found: .\a.exe
a.exe
  C:\cygwin\bin\cygwin1.dll
    C:\WINNT\system32\ADVAPI32.DLL
      C:\WINNT\system32\NTDLL.DLL
      C:\WINNT\system32\KERNEL32.DLL
      C:\WINNT\system32\RPCRT4.DLL


-- 
   Alex Vinokur
     http://mathforum.org/library/view/10978.html
     http://sourceforge.net/users/alexvn







--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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