This is the mail archive of the cygwin@sources.redhat.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]

STATUS_ACCESS_VIOLATION/segfault problems with cygwin 1.1.4


I've been following the threads about STATUS_ACCESS_VIOLATION/segfault
problems for some days now, since I had really bad troubles running a
software which works without a hitch under Linux and mingw, and also used to
work with previous gnuwin32/cygwin releases.

I've been looking into it, and I am 100% sure that's it a problem with the
latest cygwin release (maybe with the linker or ar, or with the system
libraries, you experts know better ;-).

The problem occurs whenever you build a static library and a program which
is linked to both this library and libm.a. I can reproduce it with sources
as simple as the following:

*** Makefile:

t: t.o libl.a
 gcc -o t t.o -lm -L. -ll

t2: t2.o
 gcc -o t2 t2.o -lm

libl.a: l.o
 ar cr $@ l.o
# ranlib $@

clean:
 rm -f *.o *.a *.exe

*** t.c:

int main()
{
  test("hello");
}

*** l.c:

#include <stdio.h>

void test(char *s)
{
  puts(s);
}

---

The build process:
$ make
gcc    -c -o t.o t.c
gcc    -c -o l.o l.c
ar cr libl.a l.o
gcc -o t t.o -lm -L. -ll

Run the program:
$ ./t
      0 [main] T 1602 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
   1084 [main] T 1602 stackdump: Dumping stack trace to T.EXE.stackdump
Segmentation fault (core dumped)

The same program works fine when the -lm is omitted:
$ gcc -o t t.o -L. -ll
$ ./t
hello

And it only happens when invoking the test() function from a separate
library (the standard hello world program works), so probably it is not a
problem with libm.a alone.

My system is: Intel Pentium III-500/256 MB, Windows 98 SE (German), running
cygwin 1.1.4, cygcheck -s gives: Win9X Ver 4.10 build 67766446  A. The gcc
is 2.95.2, of course.

Ok, I hope that you can figure this out... BTW, I also suspect that there's
a problem with dlopen() in the latest cygwin, but I'll have to recheck once
this problem is solved.

Cheers,
Albert

Dr. Albert Graef
Dr.Graef@t-online.de, ag@muwiinfa.geschichte.uni-mainz.de
http://www.musikwissenschaft.uni-mainz.de/~ag



--
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]