This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, libgfortran] PR 61310 CTIME intrinsic output incorrect on MinGW


Hi,

GFortran currently uses strftime(...,"%c",...) to produce the result
for the CTIME and FDATE intrinsics. Unfortunately, it seems that on
MinGW this does not produce identical output to the C stdlib ctime(),
even in the default locale.

The attached patch implements an alternative approach, originally
suggested by Jakub in PR 47802, to produce a thread-safe ctime-like
function by using snprintf manually.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk/4.9/4.8/4.7?

2014-05-26  Janne Blomqvist  <jb@gcc.gnu.org>

    PR libfortran/61310
    * intrinsics.texi (CTIME): Remove mention of locale-dependent
    behavior.

2014-05-26  Janne Blomqvist  <jb@gcc.gnu.org>

    PR libfortran/61310
    * intrinsics/ctime.c (strctime): Rename to gf_ctime, use snprintf
    instead of strftime.
    (fdate): Use gf_ctime.
    (fdate_sub): Likewise.
    (ctime): Likewise.
    (ctime_sub): Likewise.


-- 
Janne Blomqvist

Attachment: ctime.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]