time_get is not reading time_put weekdays output for French locale

Latest response

time_get is not reading time_put weekdays output for French locale.  This issue occurs on both Red hat 5 and 6.

 

$>cat t.cpp && g++ -v && uname -srm && g++ t.cpp && ./a.out
#include <iostream>
#include <sstream>
#include <locale>
using namespace std;

int main ()
{
  locale loc("fr_FR");
  ostringstream os;
  os.imbue (loc);

  const time_put<char>& tmput = use_facet <time_put<char> > (loc);
  tm t;
  t.tm_wday = 2;

  tmput.put (os, os, ' ', &t, 'A');
  cout << os.str() << endl;

  t.tm_wday = 0;

  istringstream is(os.str());
  is.imbue (loc);
  const time_get<char>& tmget = use_facet <time_get<char> > (loc);
  ios::iostate state;
  istreambuf_iterator<char> itbegin (is);
  istreambuf_iterator<char> itend;

  tmget.get_weekday (itbegin, itend, is, state, &t);

  cout << "weekday: " << t.tm_wday << endl;
  return 0;
}
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC)
Linux 2.6.32-131.0.15.el6.x86_64 x86_64
mardi
weekday: 0
 

Responses

Hello Ben,

 

Thanks for raising the issue.

 

I tried the code provided on the latest gcc package released for RHEL 6.3 (gcc version 4.4.6 20120305) and I could reproduce it:

 

  • French:

mardi
weekday: 0

 

  • English:

Tuesday
weekday: 2

 

It does work for the weekday name but not for the count when using FR locale.

 

Cheers,

 

Caetano

Hello Ben,

 

We have done further investigation on the issue and we confirmed that the problem does not happen on the GCC released on Fedora 17 (gcc version 4.7.2 20120921).

 

This could be a bug and an investigation is required. Could you please open a new support case for this issue? Then further details can be gathered and possibly a Bugzilla created.

 

Let me know the case number, so I can follow up.

 

Thanks.

 

Caetano

Hello Ben,

 

 

German, Dutch, British English and US English work fine on RHEL 6.3 64-bits.

 

French fails also for me.

 

Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc versie 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)

 

uname -a
Linux lenovo.internal.kootstra.co.uk 2.6.32-279.9.1.el6.x86_64 #1 SMP Fri Aug 31 09:04:24 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

 

 

Kind regards,

 

 

Jan Gerrit Kootstra

Hello Ben,

 

This issue has been reported to Bugzilla now and the engineering team is analysing it. The Bugzilla number is 866885: GCC - time_get and time_put operations fail.

 

Thanks again.

 

Caetano