stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-65) std::numeric_limits<int>::traps = false when integer arithmetic traps
Date Fri, 11 Nov 2005 00:09:03 GMT
std::numeric_limits<int>::traps = false when integer arithmetic traps
---------------------------------------------------------------------

         Key: STDCXX-65
         URL: http://issues.apache.org/jira/browse/STDCXX-65
     Project: STDCXX
        Type: Bug
  Components: 18. Language Support  
    Versions: 4.1.2    
 Environment: all
    Reporter: Martin Sebor
 Assigned to: Martin Sebor 
    Priority: Minor
     Fix For: 4.1.3


The program below aborts. See also the related LWG issue 497:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#497

$ cat t.cpp && nice make t -r CPPOPTS=-DSIGTRAP=5 && ./t
#include <cassert>
#include <csetjmp>
#include <csignal>
#include <limits>

std::jmp_buf env;

extern "C" void handle_trap (int)
{
    std::longjmp (env, 1);
}

volatile int zero;

int main ()
{
    const bool traps = std::numeric_limits<int>::traps;

    bool trapped = false;

    std::signal (SIGFPE, handle_trap);
    std::signal (SIGTRAP, handle_trap);
    if (0 == setjmp (env)) {
        zero = 2 / zero;
    }
    else {
        trapped = true;
    }

    assert (traps && trapped || !traps && !trapped);
}
eccp -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG    -D_RWSTD_USE_CONFIG -I/build/sebor/eccp-3.6-11s/include
-I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include
-I/build/sebor/dev/stdlib/tests/include -DSIGTRAP=5 -A -x --template_directory=/build/sebor/eccp-3.6-11s/lib
-g  --display_error_number --remarks --diag_suppress 193,236,340,401,261,479,487,678,679,815
 t.cpp
eccp t.o -o t -L/build/sebor/eccp-3.6-11s/rwtest -lrwtest11s --template_directory=/build/sebor/eccp-3.6-11s/lib
  -L/build/sebor/eccp-3.6-11s/lib -lstd11s   -lm
t.cpp:30: Assertion 'traps && trapped || !traps && !trapped' failed.
/build/sebor/eccp-3.6-11s/tests/t:__rw_assert_fail__4__rwFPCcT1iT1+0x84
/build/sebor/eccp-3.6-11s/tests/t:main+0xcc
/build/sebor/eccp-3.6-11s/tests/t:_start+0x5c
Abort (core dumped)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message