Hello autoconfers.

I've found this problem some times ago when extending the automake
testsuite.  Sorry for only reporting it now.

 $ cat foo.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/wait.h>
 int main(void)
 {
   int wstatus = system("kill -15 $$");
   printf ("RETURN:      0x%x\n", wstatus);
   printf ("WTERMSIG:    %d\n",   WTERMSIG (wstatus));
   printf ("WEXITSTATUS: %d\n",   WEXITSTATUS (wstatus));
   return 0;
 }

 $ uname -mrsv
 Linux 2.6.30-2-686 #1 SMP Sat Sep 26 01:16:22 UTC 2009 i686
 $ gcc --version
 gcc (Debian 4.5.3-5) 4.5.3
 $ gcc -Wall foo.c
 $ ./a.out # as expected
 RETURN:      0xf
 WTERMSIG:    15
 WEXITSTATUS: 0

 $ uname -msrv
 SunOS 5.10 Generic_144489-06 i86pc
 $ gcc --version
 gcc (GCC) 4.6.0
 $ gcc -Wall foo.c
 $ ./a.out # unexpected
 RETURN:      0xd000
 WTERMSIG:    0
 WEXITSTATUS: 208
 $ suncc -V       
 cc: Sun C 5.9 SunOS_i386 Patch 124868-15 2010/08/11
 $ suncc foo.c
 $ ./a.out # same error
 RETURN:      0xd000
 WTERMSIG:    0
 WEXITSTATUS: 208

See also:
 <http://dbaspot.com/shell/396118-bourne-shell-exit-code-term.html>

I might write a documentation patch in a few days if nobody
beats me.

Regards,
  Stefano

Reply via email to