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/02/11 18:26:08 UTC
[jira] Issue Comment Edited: (STDCXX-673) [IBM XLC++ 9.0/AIX 5.3]
0.printf fails with assertions
[ https://issues.apache.org/jira/browse/STDCXX-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12548544#action_12548544 ]
sebor edited comment on STDCXX-673 at 2/11/08 9:25 AM:
--------------------------------------------------------------
Hmm, you're right. According to the config header for XLC++ on AIX, char is an unsigned type (see the script below -- I ran all the configurations to make sure the bug wasn't due to an optimization or some such quirk).
I suspect I might have wanted to avoid printing "signed" for chars (when char is a signed type) to get the same result as the C99 implementation on the platform I was testing on for compatibility with it (i.e., to make sure int8_t was a typedef the same fundamental type whether it was defined by the C library on the OS or by stdcxx). Obviously, that won't work on platforms where the C library defines int8_t to be a typedef for signed char even if char is signed, but that's a separate issue.
In any case, I think the bug is in the condition on line 413. See if this patch works:
{noformat}
Index: etc/config/src/LIMITS.cpp
===================================================================
--- etc/config/src/LIMITS.cpp (revision 601038)
+++ etc/config/src/LIMITS.cpp (working copy)
@@ -410,7 +410,7 @@
printf ("#define _RWSTD_INT%d_T %s %s%s\n" \
"#define _RWSTD_UINT%d_T %s unsigned %s\n", \
width, width < 10 ? " " : "", \
- 8 == width && '\xff' < 0 ? "signed " : "", type, \
+ 8 == width && 0 < '\xff'? "signed " : "", type, \
width, width < 10 ? " " : "", type); \
} while (0)
{noformat}
And here's the script (I think it's kinda nifty, btw.):
{noformat}
$ for n in 8 11 12 15; do \
for s in a A d D s D; do \
wget -O- -q http://people.apache.org/~sebor/stdcxx/results/aix-5.3-ppc-vacpp-9.0-$n$s-600031-cfg-h.gz.txt \
| gunzip -c 2>/dev/null | grep _RWSTD_CHAR_MAX; \
done; \
done
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
{noformat}
was (Author: sebor):
Hmm, you're right. According to the config header for XLC++ on AIX, char is an unsigned type (see the script below -- I ran all the configurations to make sure the bug wasn't due to an optimization or some such quirk).
I suspect I might have wanted to avoid printing "signed" for chars (when char is a signed type) to get the same result as the C99 implementation on the platform I was testing on for compatibility with it (i.e., to make sure int8_t was a typedef the same fundamental type whether it was defined by the C library on the OS or by stdcxx). Obviously, that won't work on platforms where the C library defines int8_t to be a typedef for signed char even if char is signed, but that's a separate issue.
In any case, I think the bug is in the condition on line 413. See if this patch works:
Index: etc/config/src/LIMITS.cpp
===================================================================
--- etc/config/src/LIMITS.cpp (revision 601038)
+++ etc/config/src/LIMITS.cpp (working copy)
@@ -410,7 +410,7 @@
printf ("#define _RWSTD_INT%d_T %s %s%s\n" \
"#define _RWSTD_UINT%d_T %s unsigned %s\n", \
width, width < 10 ? " " : "", \
- 8 == width && '\xff' < 0 ? "signed " : "", type, \
+ 8 == width && 0 < '\xff'? "signed " : "", type, \
width, width < 10 ? " " : "", type); \
} while (0)
And here's the script (I think it's kinda nifty, btw.):
$ for n in 8 11 12 15; do \
for s in a A d D s D; do \
wget -O- -q http://people.apache.org/~sebor/stdcxx/results/aix-5.3-ppc-vacpp-9.0-$n$s-600031-cfg-h.gz.txt \
| gunzip -c 2>/dev/null | grep _RWSTD_CHAR_MAX; \
done; \
done
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
#define _RWSTD_CHAR_MAX '\xff'
> [IBM XLC++ 9.0/AIX 5.3] 0.printf fails with assertions
> ------------------------------------------------------
>
> Key: STDCXX-673
> URL: https://issues.apache.org/jira/browse/STDCXX-673
> Project: C++ Standard Library
> Issue Type: Bug
> Components: Test Driver
> Affects Versions: 4.2.0
> Reporter: Travis Vitek
> Assignee: Travis Vitek
> Priority: Minor
> Fix For: 4.2.1
>
> Attachments: stdcxx-673.patch
>
>
> extension: "%{N}" buffer size
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "foo", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "foo", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "foo", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "foo", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "bar", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "bar", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "bar", va_list) error: errno = 12: Not enough space
> /amd/devco/vitek/stdcxx/trunk/tests/src/printf.cpp:1022: rw_vasnprintf(ffffffffffff8d0, ffffffffffff8d8, "bar", va_list) error: errno = 12: Not enough space
> extension: "%{@}" nested format directive
> malformed directives
> Failed 8 out of 1572 assertions.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.