This is the mail archive of the gcc-bugs@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]

c/4177: in printf only first call to asctime(localtime(..)) is evaluated



>Number:         4177
>Category:       c
>Synopsis:       in printf only first call to asctime(localtime(..)) is evaluated
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 30 04:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Joachim Wuttke
>Release:        2.95.03
>Organization:
>Environment:
rtlinux
>Description:
wrong:   Mon Mar 23 01:26:40 1970 Mon Mar 23 01:26:40 1970
correct: Mon Mar 23 01:26:40 1970 Fri Jan  9 02:32:03 1976
>How-To-Repeat:
#include <stdio.h>
#include <sys/time.h>

main()
{
   long i=7000000, p=189999123;
   printf("wrong:   %.24s %.24s\n", asctime(localtime(&i)),
                                    asctime(localtime(&p)));
   printf("correct: %.24s",         asctime(localtime(&i)));
   printf(        " %.24s\n",       asctime(localtime(&p)));
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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