The GNU GCC 3.x compiler with libstdc++ 3.x requires for geant4.4.0 a modification in the file G4strstreambuf.icc used by G4strstreambuf.hh and located in the directory ./source/global/management/include. Returning from overflow at least for cout,cerr it is required that it returns ch (the input), which is '\n' instead of zero if the buffer was flushed. (see: http://mail.gnu.org/pipermail/help-gplusplus/2001-June/000339.html) In ./source/global/management/include/G4strstreambuf.icc for G4strstreambuf::overflow one can fix it by adding after line 90 the following lines: // modification for gcc 3.0 and higher // the return value for cout, cerr overflow function has to be c #if !defined(__GNUC__) || defined(__STRICT_ANSI__) # if defined __cplusplus && __GNUC_PREREQ (3,0) if (this == & G4coutbuf || this == & G4cerrbuf) { result = c; } # endif # endif // end of modification This modification concerns the following Geant4 code: ./source/global/management/src/G4ios.cc ./source/intercoms/src/G4UImanager.cc ./source/g3tog4/src/G3EleTable.cc Therefore at least the granular libraries for those directories have to be recreated after the compilation with the modification above. Compiling with GNU GCC 2.95.3 I observed a general strange behaviour in cout as mentioned in http://mail.gnu.org/pipermail/bug-commoncpp/2001-January/000005.html which does not appear now using GNU GCC 3.x .
Hajime, Could you please look after this?
Thank you for the information. We introduced a temporary fix along the lines you suggest for gcc-3.X.X (btw, the set of flags you propose are not portable). The fix will be distributed in a public patch to release 4.0.