[Patch, libgfortran] PR 40190 DATE_AND_TIME not thread-safe

Janne Blomqvist blomqvist.janne@gmail.com
Wed May 20 22:12:00 GMT 2009


Hi,

the attached patch fixes PR 40190 by using localtime_r and gmtime_r
instead of the non-reentrant variants.

The questionable thing about the current patch is that it assumes that
the _r functions are available on all gfortran targets. If this turns
out to not be the case, I'll do a follow-up patch [1]with a configure
check and a fallback implementation. However the _r functions were
added to POSIX already in SUSv2, so maybe it's not too much to ask.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

[1] I have this partially done, but I'm not able to regenerate
configure properly, it bombs out with

/home/janne/src/gfortran/trunk/trunk-git/libgfortran/configure: line
15664: syntax error near unexpected token `gstdint.h'
/home/janne/src/gfortran/trunk/trunk-git/libgfortran/configure: line
15664: `GCC_HEADER_STDINT(gstdint.h)'

Anyone seen something similar? Commenting out the
GCC_HEADER_STDINT(gstdint.h) line in configure.ac (line 65) fixes
this, but supposedly it has been added for some reason at some point.

-- 
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ChangeLog
Type: application/octet-stream
Size: 319 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090520/973ad044/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: datetime-threadsafe.diff
Type: text/x-diff
Size: 2144 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090520/973ad044/attachment.bin>


More information about the Gcc-patches mailing list