[gccsdk] [Bug 249] New: GCC 4.7.4 Rel 1 Dev 2014-01-08: mktime() returns wrong value

bugzilla-daemon at riscos.info bugzilla-daemon at riscos.info
Sat Mar 8 03:52:52 PST 2014


http://www.riscos.info/bugzilla3/show_bug.cgi?id=249

           Summary: GCC 4.7.4 Rel 1 Dev 2014-01-08: mktime() returns wrong
                    value
           Product: GCC/GCCSDK
           Version: other
          Platform: Other
        OS/Version: RISC OS
            Status: NEW
          Severity: normal
          Priority: P1
         Component: C compiler
        AssignedTo: John.Tytgat at aaug.net
        ReportedBy: duncan.moore at gmx.com
   Estimated Hours: 0.0


GCCSDK GCC 4.7.4 Release 1 Development 4.7.4 2014-01-08
http://www.riscos.info/downloads/gccsdk/testing/4.7.4/gccsdk-gcc-bin-4.7.4-Rel1dev.zip
SharedUnixLibrary 1.12
VirtualRPC-Adjust RISCOS 4.39

This program prints an elapsed time using mktime().
Under gcc 4.1.2 it gives what I'd expect:

946684799

Under gcc 4.7.4 it gets it wrong. After recompiling it gets it wrong in the
same way. After rebooting it gets it wrong in a different way. Here's some of
the values it gives after rebooting:

 1633879566
-1973892963
 -943100812
 -771302120
-1114899504
   87691339

They appear to differ from the correct value by simple fractions of 2^30, e.g.:

0.64*2^30
1.92*2^30

gcc err_mktime.c

#include <stdio.h>
#include <time.h>
int main(void) {
  struct tm tm;
  tm.tm_sec  = 59;
  tm.tm_min  = 59;
  tm.tm_hour = 23;
  tm.tm_mday = 31;
  tm.tm_mon  = 11;
  tm.tm_year = 99;
  tm.tm_isdst = -1;
  time_t t = mktime (&tm);
  printf("%li\n",t);
  return 0;
}

-- 
Configure bugmail: http://www.riscos.info/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.




More information about the gcc mailing list