This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/38210] New: num_put<>::do_put(void*) performs padding incorrectly when adjustfield==internal
- From: "tsyvarev at ispras dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2008 08:49:12 -0000
- Subject: [Bug libstdc++/38210] New: num_put<>::do_put(void*) performs padding incorrectly when adjustfield==internal
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following num_put<> member function
iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val)
const
incorrectly performs padding of a string to bring its length to the required
value if 'adjustfield' flag is equal to 'internal': instead of adding fill
characters after "0x" it adds them at the beginning of the string
According to the description of padding options (22.2.2.2.2 p19), if
adjustfield == internal and representation after stage 1 began with 0x or 0X -
pad after x or X.
Example:
#include <iostream>
#include <locale>
using namespace std;
int main()
{
void *p = (void*)0x1;
cout.width(5);
cout << internal << p << endl;
return 0;
}
output " 0x1" while it should be "0x 1"
--
Summary: num_put<>::do_put(void*) performs padding incorrectly
when adjustfield==internal
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tsyvarev at ispras dot ru
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38210