showpos bug in libstdc++

Joe Buck Joe.Buck@synopsys.COM
Tue Nov 27 00:47:00 GMT 2007


On Mon, Nov 26, 2007 at 05:11:13PM -0700, Betty Evans wrote:
> I believe I have found a bug with libstdc++ but am unsure where to log
> the bug on GNU.

http://gcc.gnu.org/bugzilla/

>  I cannot test this on other systems because of
> installation privileges.  I do know that other compilers/libraries like
> Visual Studio and Sun Forte Developer do not exhibit the error.

> Bug:
> showpos will not put a plus sign before an int 0 but will put one in
> front of a float 0.

I've confirmed your bug report.  It appears to be a regression, in
that your test case works correctly for gcc-3.4.2 but fails
for gcc 4.1.2.

> Code:
> #include <iostream>
> using namespace std;
>  
> int main()
> {
>   signed int i = 5;
>   cout << "Correct: int 5 showpos =     " << showpos << i << endl;
>  
>   i = 0;
>   cout << "Error:   int 0 showpos =     " << showpos << i << endl;
>  
>   float d = 0.0;
>   cout << "Correct: float 0 showpos =   " << showpos << d << endl;
>   
>   return 0;
> }
>  
>  
> Build Command (generated automatically by eclipse):
> g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/showpos.d"
> -MT"src/showpos.d" -o"src/showpos.o" "../src/showpos.cpp"
>  
>  
> Output
> Correct: int 5 showpos =     +5
> Error:   int 0 showpos =     0
> Correct: float 0 showpos =   +0
>  
> Thanks
> Betty Evans



More information about the Libstdc++ mailing list