Subject: lib/18644: setjmp/longjmp on m68k fails with pkgsrc/devel/pth
To: None <gnats-bugs@gnats.netbsd.org>
From: Klaus Heinz <k.heinz.okt.zwei@onlinehome.de>
List: netbsd-bugs
Date: 10/13/2002 14:40:26
>Number:         18644
>Category:       lib
>Synopsis:       setjmp/longjmp on m68k fails with pkgsrc/devel/pth
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 13 11:29:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Klaus Heinz
>Release:        NetBSD 1.5.3
>Organization:
none
>Environment:
System: NetBSD rainbow.homedns.org 1.5.3 NetBSD 1.5.3 (GENERIC) #0: Tue Jul
2 13:44:43 EDT 2002 john@reva.sixgirls.org:/usr/src/sys/arch/amiga/compile/GENERIC amiga


>Description:
	On NetBSD/1.5.3 for m68k (Amiga in my case), pkgsrc/devel/pth
	1.4.1nb2 does not work (see also PR pkg/18236). The research
	done for pkg/18236 suggests there are two problems connected
	with this, probably a toolchain problem (described in a
	different PR) and a libc problem with setjmp/longjmp which seems
	similar to the one described in port-vax/11698; at least the
	error message is the same.

	The problem with *jmp occurred while running 'make test' with
	executables compiled without optimisation (-O0) in order to
	avoid the toolchain bug.

  $ cd work/pth-1.4.1
  $ ./test_std
  longjmp botch.
  Illegal instruction - core dumped

  $ gdb .libs/test_std test_std.core
  ... 
  This GDB was configured as "m68k--netbsd"...
  Core was generated by `test_std'.
  Program terminated with signal 4, Illegal instruction.
  Reading symbols from /usr/libexec/ld.so...done.
  Reading symbols from
  /var/tmp/pkgsrc/devel/pthO0/work/pth-1.4.1/./.libs/libpth.s
  o.14.21...done.
  Reading symbols from /usr/lib/libc.so.12.62.1...done.
  #0  0x805c9c6 in __longjmp14 ()
  [Established Pth Debugging Environment]
  (gdb) where
  #0  0x805c9c6 in __longjmp14 ()
  #1  0x80353f6 in __pth_mctx_set (mctx=0xa06c,
      func=0x80385c8 <pth_spawn_trampoline>, sk_addr_lo=0xc000 "",
      sk_addr_hi=0x1c000 <Address 0x1c000 out of bounds>) at pth_mctx.c:358
  #2  0x80389ac in pth_spawn (attr=0x8040, func=0x8035aa0 <__pth_scheduler>,
      arg=0x0) at pth_lib.c:283
  #3  0x8038052 in __pth__init () at pth_lib.c:67
  #4  0x803f390 in write (fd=2, buf=0xdffef38, nbytes=37) at pth_syscall.c:267
  #5  0x80aa9a4 in __swrite ()
  #6  0x80a909a in __sflush ()
  #7  0x80a9042 in fflush ()
  #8  0x8076f00 in flock ()
  #9  0x807702c in vfprintf ()
  #10 0x80a8d7c in fprintf ()
  #11 0x2af4 in main (argc=1, argv=0xdfff63c) at test_std.c:80

	Similar output (#0 - #3) can be seen from core dumps of the
	other tests.
	
>How-To-Repeat:
	- On a m68k machine with NetBSD 1.5.3 go to pkgsrc/devel/pth (1.4.1nb2)
	- 'DBG=-O0 make test'
	- observe the tests failing with 'longjmp botch   Illegal
	  instruction - core dumped'
>Fix:
	port-vax/11698 mentions m68k but as a positive example where
	_that_ bug does not happen :-/. I don't know whether the
	proposed fix for port-vax/11698 could be adapted to this PR.
>Release-Note:
>Audit-Trail:
>Unformatted: