BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001090 [buildroot] Architecture Specific major always 11-14-06 00:01 08-25-08 05:32
Reporter GJanak View Status public  
Assigned To buildroot
Priority normal Resolution open  
Status assigned   Product Version
Summary 0001090: stdlibc++ fails putting a double in a stream.
Description The problem was:
putting a double in a stream:
cout << 10.5 ;

Produce an empty string, or some garbage characters.

I could resolve the error down to some wired Code combination between uclibc and libstdc++
Additional Information GCC 4.1.1
uclibc 0.9.27 and snapshot and Current subversion
different binutils...
powerpc Platform.
wchar or without wchar (patched Makefile) no difference.

Background:
in buildroot/toolchain_build_powerpc/gcc-4.1.1-final/powerpc-linux-uclibc/libstdc++-v3;

in include/bits/locale_facets.tcc line 1099 (and others)
(because _GLIBCXX_USE_C99 dont seems to be defined)
int __len = std::__convert_from_v(__cs, 0, ...
is called.

But the uclibc implementation of __convert_from_v uses the size /second parameter) for an snprintf.

Solution:

replace the zero with cs_size, calculated some lines above for allocation.
Doesnt hurt anyone.


Please write comment, if i'm was wrong...
Attached Files  gcc_snprintf_double_cssize.patch [^] (990 bytes) 08-27-07 05:02
 c_locale.h [^] (3,802 bytes) 08-25-08 05:32

- Relationships

- Notes
(0002152)
GJanak
02-12-07 05:50

I don't think it's an buildroot Problem.

Its an uclibc c++ error...
 
(0002698)
GJanak
08-27-07 05:02

New info.

The Problem is: very old files are patched into current gcc releases.
I mean the toolchain/gcc/4.2.1/200-uclibc-locale.patch
which creates
gcc/libstdc++-v3/config/locale/uclibc/c_locale.cc

The file created by the patch is based on the generic Config and than patched for uclibc. But the generic is changed with 4.x.x.

Best solution would be to copy the gcc/libstdc++-v3/config/locale/generic Dir and than add a patch on this Dir.

The Differences needed would be smaller. And perhaps the Patch would work for multiple gcc versions.
 
(0002699)
GJanak
08-27-07 05:03

The Patch gcc_snprintf_double_cssize.patch is a workaround, hacking the change in gcc. But it isnt a good solution.
 
(0010764)
ncoesel
08-25-08 05:31

I've been bitten by this as well. IMHO the proper solution is to mimic non-C99 behaviour so convert_from_v should use sprintf instead of snprintf when the size is 0. I attached the modified c_locale.h file.
 

- Issue History
Date Modified Username Field Change
11-14-06 00:01 GJanak New Issue
11-14-06 00:01 GJanak Status new => assigned
11-14-06 00:01 GJanak Assigned To  => uClibc
11-14-06 00:05 GJanak Issue Monitored: GJanak
02-12-07 05:34 vapier Assigned To uClibc => buildroot
02-12-07 05:50 GJanak Note Added: 0002152
08-27-07 05:02 GJanak Note Added: 0002698
08-27-07 05:02 GJanak File Added: gcc_snprintf_double_cssize.patch
08-27-07 05:03 GJanak Note Added: 0002699
08-25-08 05:31 ncoesel Note Added: 0010764
08-25-08 05:32 ncoesel File Added: c_locale.h


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker