From issues-return-843-apmail-stdcxx-issues-archive=stdcxx.apache.org@stdcxx.apache.org Wed Mar 26 02:05:31 2008 Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 73316 invoked from network); 26 Mar 2008 02:05:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2008 02:05:31 -0000 Received: (qmail 59513 invoked by uid 500); 26 Mar 2008 02:05:30 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 59497 invoked by uid 500); 26 Mar 2008 02:05:30 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 59488 invoked by uid 99); 26 Mar 2008 02:05:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2008 19:05:30 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2008 02:04:59 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 68922234C0AB for ; Tue, 25 Mar 2008 19:03:24 -0700 (PDT) Message-ID: <637167609.1206497004413.JavaMail.jira@brutus> Date: Tue, 25 Mar 2008 19:03:24 -0700 (PDT) From: "Martin Sebor (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Commented: (STDCXX-624) [gcc/Linux] std::numeric_limits::traps = false when integer arithmetic traps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582099#action_12582099 ] Martin Sebor commented on STDCXX-624: ------------------------------------- As to why the example program [limits.cpp|http://svn.apache.org/repos/asf/stdcxx/trunk/examples/manual/limits.cpp] produces a {{DIFF}} result in some builds, I suspect it's because the expected output file [limits.out|http://svn.apache.org/repos/asf/stdcxx/trunk/examples/manual/out/limits.out] hardcodes {{true}} as the value of {{numeric_limits::traps}} while the actual value as determined by the [NO_INT_TRAPS.cpp|http://svn.apache.org/repos/asf/stdcxx/trunk/etc/config/src/NO_INT_TRAPS.cpp] config test is {{false}} on Linux/x86_64. > [gcc/Linux] std::numeric_limits::traps = false when integer arithmetic traps > --------------------------------------------------------------------------------- > > Key: STDCXX-624 > URL: https://issues.apache.org/jira/browse/STDCXX-624 > Project: C++ Standard Library > Issue Type: Bug > Components: 18. Language Support > Affects Versions: 4.2.0 > Environment: gcc 4.1.0 on SUSE Linux Enterprise Server 10 (x86_64) > Reporter: Martin Sebor > Assignee: Martin Sebor > Priority: Trivial > Fix For: 4.2.1 > > Original Estimate: 4h > Time Spent: 2h > Remaining Estimate: 2h > > As an extension, stdcxx defines the value of {{std::numeric_limits::traps}} for integer {{T}} to be true when there exists an arithmetic operation on type T that traps for some value of {{T}}. Based on this definition the program below should always run successfully to completion but when compiled with gcc 4.1.0 with optimization enabled on SUSE Linux Enterprise Server 10 (x86_64) it aborts at runtime. (This is also why the example program [limits.cpp|http://svn.apache.org/repos/asf/stdcxx/trunk/examples/manual/limits.cpp] produces a {{DIFF}} result in some builds). > {code} > $ cat t.cpp && make t && ./t > #include > #include > #include > #include > char digits[] = " +0.?23456789e+01"; > int main () > { > digits [4] = '0'; > const int zero = (int)std::strtod (digits, 0); > digits [4] = '1'; > const int x = (int)std::strtod (digits, 0); > if (!std::numeric_limits::traps) { > const int div = x / zero; > const int mod = x % zero; > std::printf ("%d, %d\n", div, mod); > } > } > gcc -c -I/amd/devco/sebor/stdcxx-4.2.x/include/ansi -pthread -I/amd/devco/sebor/stdcxx-4.2.x/include -I/build/sebor/stdcxx-4.2.x-gcc-4.1.0-12D/include -I/amd/devco/sebor/stdcxx-4.2.x/examples/include -pedantic -nostdinc++ -O2 -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp > gcc t.o -o t -pthread -L/build/sebor/stdcxx-4.2.x-gcc-4.1.0-12D/lib -Wl,-R/build/sebor/stdcxx-4.2.x-gcc-4.1.0-12D/lib -lstd12D -lsupc++ -lm > Floating point exception > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.