stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek" <Travis.Vi...@roguewave.com>
Subject RE: Exit code 3 on MSVC and ICC/Windows
Date Thu, 10 Apr 2008 17:55:25 GMT
 

>Farid Zaripov wrote:
>
>  Below is a listing of the raise() function from MSVC CRT:
>

Yes, but unfortunately I can't reproduce most of those exit 3 failures
locally. Here are a list of programs that fail with code 3 in nightly
builds...

  22.locale.codecvt.length
  22.locale.codecvt.out
  22.locale.ctype.is
  22.locale.ctype.scan
  22.locale.ctype.tolower
  22.locale.ctype.toupper
  22.locale.ctype
  22.locale.moneypunct.mt
  22.locale.time.get.mt
  22.locale.time.get
  22.locale.time.put

I see no problem if I run these executables, either by themselves or
under the exec utility...

C:\Build\stdcxx\trunk\msvc-8.0\15s\tests>..\bin\exec.exe @list
NAME                                     STATUS WARN ASSERTS FAILED
PERCNT    USER     SYS    REAL
22.locale.codecvt.length.exe                  0    6     304      2
99%   0.015   0.031   0.140
22.locale.codecvt.out.exe                     0    5     789      2
99%   0.031   0.000   0.125
22.locale.ctype.is.exe                        0    4     129      2
98%   0.015   0.031   0.125
22.locale.ctype.scan.exe                      0    4      29      2
93%   0.015   0.000   0.109
22.locale.ctype.tolower.exe                   0    4      13      2
84%   0.015   0.015   0.109
22.locale.ctype.toupper.exe                   0    4      13      2
84%   0.015   0.031   0.125
22.locale.ctype.exe                           0    4    1411    383
72%   0.031   0.015   0.140
22.locale.moneypunct.mt.exe                   0    1       5      1
80%   0.234   0.000   0.140
22.locale.time.get.mt.exe                     0    1       7      1
85%   4.328   0.500   4.041
22.locale.time.get.exe                        0   20    1871     17
99%   0.046   0.015   0.140
22.locale.time.put.exe                        0   11    2104     17
99%   0.031   0.015   0.109
PROGRAM SUMMARY:
  Programs:                    11
  Non-zero exit status:         0
  Signalled:                    0
  Compiler warnings:            0
  Linker warnings:              0
  Runtime warnings:            64
  Assertions:                6675
  Failed assertions:          431
  Cumulative times:
    Real                        5.303s
    User                        4.776s
    Sys                         0.653s

So I'm stumped how this exit code 3 thing can be coming up if the
program itself returns 0, and the exec utility correctly detects the
return code.

Also, just as an aside, the exec utility function kill_child_process()
can call TerminateProcess() with exit code 3 if sending ctrl+c and
ctrl+break don't kill the process first.

    /* Then hard kill the child process */
    if (0 == TerminateProcess (child.hProcess, 3))
        warn_last_error ("Terminating child process");
    else if (WAIT_FAILED == WaitForSingleObject (child.hProcess, 1000))
        warn_last_error ("Waiting for child process");

Are you able to reproduce the exit code 3, or at least a debug dialog
for any of the above mentioned tests?

Travis


>int __cdecl raise (
>        int signum
>        )
>{
>[...]
>        /*
>         * If the current action is SIG_IGN, just return
>         */
>        if ( sigact == SIG_IGN )
>                return(0);
>
>        /*
>         * If the current action is SIG_DFL, take the default action
>         */
>
>        if ( sigact == SIG_DFL ) {
>                /*
>                * The current default action for all of the supported
>                * signals is to terminate with an exit code of 3.
>                */
>                _exit(3);
>        }
>
>[...]
>}
> 
>  And also the listing of the abort() :
> 
>void __cdecl abort (
>        void
>        )
>{
>        _PHNDLR sigabrt_act = SIG_DFL;
>        if (__abort_behavior & _WRITE_ABORT_MSG)
>        {
>            /* write the abort message */
>            _NMSG_WRITE(_RT_ABORT);
>        }
> 
>        /* Check if the user installed a handler for SIGABRT.
>        * We need to read the user handler atomically in the case
>        * another thread is aborting while we change the signal
>        * handler.
>        */
>        sigabrt_act = __get_sigabrt();
>        if (sigabrt_act != SIG_DFL)
>        {
>            raise(SIGABRT);
>        }
> 
>        /* If there is no user handler for SIGABRT or if the user
>        * handler returns, then exit from the program anyway
>        */
>[...]
>        /* If we don't want to call ReportFault, then we call
>         * _exit(3), which is the
>         * same as invoking the default handler for SIGABRT
>         */
>
>        _exit(3);
>}
>
>Farid.


Mime
View raw message