This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/4177: in printf only first call to asctime(localtime(..)) is evaluated
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/4177: in printf only first call to asctime(localtime(..)) is evaluated
- From: joachim dot wuttke at icn dot siemens dot de
- Date: 30 Aug 2001 11:49:51 -0000
- Cc: jwuttke at ph dot tum dot de
- Reply-To: joachim dot wuttke at icn dot siemens dot de
>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: