www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/01/16/21:35:39

From: haible AT ilog DOT fr (Bruno Haible)
Subject: Looking for WinNT 3.51 volunteer
16 Jan 1998 21:35:39 -0800 :
Message-ID: <199801141836.TAA07982.cygnus.gnu-win32@halles.ilog.fr>
To: gnu-win32 AT cygnus DOT com
Cc: Mumit Khan <khan AT xraylith DOT wisc DOT edu>

Hi,

The function longjmp() does not work in Mingw32 (egcs-1.00 release)
on WinNT 3.51. Instead, the process exits, without any error message.

Here is a test example:

==========================================
#include <stdio.h>
#include <setjmp.h>

void foo1 (jmp_buf buf)
{
  printf("entering foo1\n");
  longjmp(buf,1);
  printf("exiting foo1\n");
}

void foo2 (jmp_buf buf)
{
  printf("entering foo2\n");
  foo1(buf);
  printf("exiting foo2\n");
}

void foo3 (jmp_buf buf)
{
  printf("entering foo3\n");
  foo2(buf);
  printf("exiting foo3\n");
}

int main ()
{
  jmp_buf buf;
  printf("entering main\n");
  if (setjmp(buf)==0)
    foo3(buf);
  else
    printf("returned from longjmp\n");
  printf("exiting main\n");
  return 0;
}
============================================

On any reasonable Unix machine, this prints:

entering main
entering foo3
entering foo2
entering foo1
returned from longjmp
exiting main

On mingw32, WinNT 3.51, it prints:

entering main
entering foo3
entering foo2
entering foo1

Note that gdb from mingw32 on this system has the same behaviour:
Anything which makes a gdb command abort (like typing `q' or any error)
kills gdb.

Can someone try to track this down?

I tried the following:
  - On Win95 longjmp works ok.
  - copying the Win95 crtdll.dll to WinNT's SYSTEM32 directory doesn't help.
  - bzero'ing the jmp_buf before the setjmp doesn't help.
  - removing lib\gcc-lib\i386-mingw32\egcs-2.90.21\ld doesn't help.
  - using the specs.crt instead of specs doesn't help; the other two specs.*
    files yield link errors.

Bruno <haible AT ilog DOT fr>
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019