wofan / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

floating point values not output on Mac OS gcc4.5 #97

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. compile the attached main.cpp on Mac OS using gcc 4.5 (*not* the default gcc 
4.2 from Apple)

#include <iostream>
#include <glog/logging.h>

int
main (int ac, char * av [])
{
    google::InitGoogleLogging (av[0]);

    double v = 1234.5;
    std::cout << "logging value via std::ostream: [" << v << "]" << std::endl;
    LOG (ERROR) << "logging value via glog: [" << v << "]";

    return 0;
}

2. run the executable

What is the expected output? What do you see instead?

expected:

logging value via std::ostream: [1234.5]
logging value via glog: [1234.5]

actual:

logging value via std::ostream: [1234.5]
logging value via glog: [

What version of the product are you using? On what operating system?

GLOG:    v0.3.1

OS:       Darwin ghost 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 
PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

GCC (v4.5.0 installed via fink):

Using built-in specs.
COLLECT_GCC=g++-4
COLLECT_LTO_WRAPPER=/sw/lib/gcc4.5/libexec/gcc/x86_64-apple-darwin10.4.0/4.5.0/l
to-wrapper
Target: x86_64-apple-darwin10.4.0
Configured with: ../gcc-4.5.0/configure --prefix=/sw --prefix=/sw/lib/gcc4.5 
--mandir=/sw/share/man --infodir=/sw/lib/gcc4.5/info 
--enable-languages=c,c++,fortran,objc,obj-c++,java --with-gmp=/sw 
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw 
--with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib 
--program-suffix=-fsf-4.5
Thread model: posix
gcc version 4.5.0 (GCC) 

Please provide any additional information below.

* it's not just that only floating point values are skipped -- the entire line 
(chain of <<'s) following the first such value is truncated (note the absence 
of closing ']' above)

* the issue is the same for floats and doubles (but not present for integral 
types or strings)

* if I use a LogSink, its send() methods receives zero message_len when 
floating point values are output

* the issue is not present if the default OS gcc (Apple v4.2) is used instead; 
this is not an acceptable workaround for my large codebase as that version 
lacks many features that have been added to later GCC versions

Original issue reported on code.google.com by vlad.rou...@gmail.com on 5 Sep 2011 at 2:03

Attachments: