You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/04/09 00:13:24 UTC
[jira] Created: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer in
LP64
[Sun C++] SIGFPE in 20.temp.buffer in LP64
------------------------------------------
Key: STDCXX-841
URL: https://issues.apache.org/jira/browse/STDCXX-841
Project: C++ Standard Library
Issue Type: Bug
Components: Tests
Affects Versions: 4.2.0
Environment: Sun C++
Reporter: Martin Sebor
Assignee: Eric Lemings
Priority: Minor
Fix For: 4.2.1
When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer
in LP64
Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588619#action_12588619 ]
Eric Lemings commented on STDCXX-841:
-------------------------------------
I haven't tested this yet but I think the patch is pretty simple:
{noformat}
Index: utilities/20.temp.buffer.cpp
===================================================================
--- utilities/20.temp.buffer.cpp (revision 647022)
+++ utilities/20.temp.buffer.cpp (working copy)
@@ -268,6 +268,11 @@
// exercise arithmetic overflow (not to be confused
// with the out-of-memory tests below)
+ // prevent overflow when sizeof(T) is almost as large
+ // as _RWSTD_SIZE_MAX
+ if ((_RWSTD_SIZE_MAX >> 1) <= i)
+ break;
+
// attempts to allocate space for an array of elements
// with a total size that exceeds SIZE_MAX must fail
nelems = _RWSTD_PTRDIFF_MAX / i + 1;
{noformat}
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Time Spent: 0.5h
> Remaining Estimate: 1.5h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer
in LP64
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588665#action_12588665 ]
Martin Sebor commented on STDCXX-841:
-------------------------------------
The {{SIGFPE}} happens in the computation of {{nelems}}, while dividing {{PTRDIFF_MAX}} by the value of {{i}}, when the value is 0. Since on this platform the macro {{\_RWSTD_NO_INT_TRAPS}} is not #defined, integer division by zero traps. The simple fix is to (also) break out of the loop when {{i}} reaches zero.
Incidentally, I'd be curious to know why the test doesn't fail with the same signal when compiled with gcc 4.1 in the same configuration and on the same server since it doesn't #define {{\_RWSTD_NO_INT_TRAPS}} either...
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Time Spent: 0.5h
> Remaining Estimate: 1.5h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer
in LP64
Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588028#action_12588028 ]
Eric Lemings commented on STDCXX-841:
-------------------------------------
Some sort of arithmetic overflow evaluating this test:
{noformat}
file stdcxx/trunk/tests/utilities/20.temp.buffer.cpp:
...
459 test_failure ((BigStruct<MAX_SIZE / 2>*)0, 0);
...
{noformat}
The terminating condition of the loop in test_failure() is not catching it:
{noformat}
file stdcxx/trunk/tests/utilities/20.temp.buffer.cpp:
...
267 for (std::size_t i = 2; i < sizeof (T); i <<= 1) {
268 // exercise arithmetic overflow (not to be confused
269 // with the out-of-memory tests below)
270
271 // attempts to allocate space for an array of elements
272 // with a total size that exceeds SIZE_MAX must fail
273 nelems = _RWSTD_PTRDIFF_MAX / i + 1;
274
275 pa = std::get_temporary_buffer<T>(nelems);
276
277 rw_assert (0 == pa.first && 0 == pa.second, 0, __LINE__,
278 "get_temporary_buffer<%s>(%ld) == { 0, 0 }, "
279 "got { %#p, %td }",
280 tname, nelems, pa.first, pa.second);
281 }
...
{noformat}
Here's what I observed cycling near what should be the end of the loop:
{noformat}
...
(dbx) cont
t@1 (l@1) stopped in test_failure<BigStruct<4611686018427387903UL> > at line 273 in file "20.temp.buffer.cpp"
273 nelems = _RWSTD_PTRDIFF_MAX / i + 1;
i = 9223372036854775808U
(dbx) cont
t@1 (l@1) stopped in test_failure<BigStruct<4611686018427387903UL> > at line 273 in file "20.temp.buffer.cpp"
273 nelems = _RWSTD_PTRDIFF_MAX / i + 1;
i = 0
{noformat}
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer
in LP64
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589956#action_12589956 ]
Farid Zaripov commented on STDCXX-841:
--------------------------------------
Merged in 4.2.x branch thus: http://svn.apache.org/viewvc?view=rev&revision=648752
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Time Spent: 1.5h
> Remaining Estimate: 0.5h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer in
LP64
Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Lemings resolved STDCXX-841.
---------------------------------
Resolution: Fixed
Regression: [Unit Test Broken]
Issue was resolved on 14 Apr 2008 with change http://svn.apache.org/viewvc?rev=647975&view=rev.
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Time Spent: 1.5h
> Remaining Estimate: 0.5h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-841) [Sun C++] SIGFPE in 20.temp.buffer
in LP64
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12588666#action_12588666 ]
Martin Sebor commented on STDCXX-841:
-------------------------------------
Also, the test output is misleading in wide builds. Here's a patch that fixes the incorrect INFO output when {{sizeof(T) > UINT_MAX}}:
{noformat}
Index: tests/utilities/20.temp.buffer.cpp
===================================================================
--- tests/utilities/20.temp.buffer.cpp (revision 646866)
+++ tests/utilities/20.temp.buffer.cpp (working copy)
@@ -39,6 +39,7 @@
#endif
#include <rw_new.h>
+#include <rw_printf.h>
#include <driver.h>
#ifndef _RWSTD_NO_SETRLIMIT
@@ -245,7 +246,7 @@
{
if (0 == tname) {
static char buf [40];
- std::sprintf (buf, "char[%u]", unsigned (sizeof (T)));
+ rw_sprintf (buf, "char[%zu]", sizeof (T));
tname = buf;
}
{noformat}
> [Sun C++] SIGFPE in 20.temp.buffer in LP64
> ------------------------------------------
>
> Key: STDCXX-841
> URL: https://issues.apache.org/jira/browse/STDCXX-841
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Tests
> Affects Versions: 4.2.0
> Environment: Sun C++
> Reporter: Martin Sebor
> Assignee: Eric Lemings
> Priority: Minor
> Fix For: 4.2.1
>
> Original Estimate: 2h
> Time Spent: 0.5h
> Remaining Estimate: 1.5h
>
> When compiled with Sun C++ (any version) in LP64 mode, the test [20.temp.buffer.cpp|http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?view=markup] abends with SIGFPE.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.